Outputing 256 characters into stream binary file
Hello!
I am trying to export a txt file from Matlab that contains a 100000 x 11 array of values. Preceding these values, I want a header that has up to 256 characters, with "Unformatted Data Version: 202409251" being the first value. I am confused how to input this, and am worried that it is because of Matlab's 63 character limit. I am using "writematrix(data, 'data.txt')" to export to txt.
What I would like the output txt file to be is below:
Unformatted Data Version: 202409251 , Time= 3.81154488E-18
NrecordsFields 8640
1 3812 1 1 1 1 1.588E-03 -9.583E-06 -9.583E-06 0.000E+00 1
11 3822 1 1 1 1 1.592E-03 -9.583E-06 -9.583E-06 0.000E+00 1
Any help would be appreciated!!
Answers (1)

- https://www.mathworks.com/help/matlab/ref/fprintf.html
- https://www.mathworks.com/help/matlab/ref/writematrix.html
3 Comments
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!