I have a text file as an output of a c++ program. Its actually a 3x100x200 element matrix. 3x100 2d matrices over 200 timestamps. I want to store this such that I can load it in Matlab workspace and then visualize it in a 3d plot. I am not able to figure out the structure of the text file. As in where should I put a "[..]" and where ";" and where a " " or ",".
Could someone please give an example so that I can print out in the file from the c++ code in a that manner
Forget the text file. Instead, write a .mat file using the Matio library. This way you will be able to quickly add some more data fields in case you need to.
If you really want to use a text file, you can first write the matrix dimensions, then all the elements, and finally do some reshaping as suggested here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With