Hi, first off, thank you for creating this project. My question is whether or not it is possible to append to an existing matfile. If it is, a brief example would really help. Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Appending to an existing matfile is not possible with the current version of csmatio. However you can:
I) read the content of a mat file,
II) append some data to the content that was read,
III) finally write the new (original+appended) content to a new file.
Here is an example:
// create a reader for the input file and read the fileMatFileReadermfr=newMatFileReader("appendInput.mat");// create a reference to complete matlab variables listList<MLArray>mlList=mfr.Data;// append some data to the matlab variables listdouble[][]doubleMatrix2by2=newdouble[2][];doubleMatrix2by2[0]=newdouble[]{3,4};doubleMatrix2by2[1]=newdouble[]{5,6};mlList.Add(newMLDouble("DoubleMatrix2by2",doubleMatrix2by2));stringtextMessage="append data to mat file";mlList.Add(newMLChar("TextMessage",textMessage));// create a writer for the output file and write the fileMatFileWritermfw=newMatFileWriter("appendOutput.mat",mlList,true);
Last edit: Tobias 2014-03-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Tobias,
I was wondering whether since this post there has been any update on appending to MAT files. I have a problem that I am trying to write about 200MB of data to a MAT file in C# but seems to crash at the MatFileWriter so it seems to be too big. Im not sure that your advice above would solve the problem because eventually you would be writing the full 200MB to the file?
Any help would be much appreciated, Thanks. Ben
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Ben, there was a similar discussion two years ago, see Ticket [#4]. I assume that things haven't changed since them. Could you give a detailled bug report?
In short: No it's not. The way the library works is "read only" from existing mat files. Writing to existing mat files would require a different approach. I'm sorry, but at the moment there are no plans for further development of the library.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, first off, thank you for creating this project. My question is whether or not it is possible to append to an existing matfile. If it is, a brief example would really help. Thank you!
Appending to an existing matfile is not possible with the current version of csmatio. However you can:
I) read the content of a mat file,
II) append some data to the content that was read,
III) finally write the new (original+appended) content to a new file.
Here is an example:
Last edit: Tobias 2014-03-19
Thank you for the example.
Last edit: jlam9012 2014-03-26
Hi Tobias,
I was wondering whether since this post there has been any update on appending to MAT files. I have a problem that I am trying to write about 200MB of data to a MAT file in C# but seems to crash at the MatFileWriter so it seems to be too big. Im not sure that your advice above would solve the problem because eventually you would be writing the full 200MB to the file?
Any help would be much appreciated, Thanks. Ben
Hi Ben, there was a similar discussion two years ago, see Ticket [#4]. I assume that things haven't changed since them. Could you give a detailled bug report?
Related
Tickets: #4
Last edit: Tobias 2016-12-17
Hi Tobias,
Was wondering if the support for appending data to an already existing mat file is available now?
Thanks.
In short: No it's not. The way the library works is "read only" from existing mat files. Writing to existing mat files would require a different approach. I'm sorry, but at the moment there are no plans for further development of the library.
I see. Thanks for the info.