Equation in the exported text file is truncated
1 view (last 30 days)
Show older comments
I solve some equations in symbolic toolbox. As Matlab only prints a limited number of characters, I write these equations in text files.
However, it seems that most of my text files are also truncated.
For example, when I copy and paste the solution Matlab tells me there is a problem with the parantheses that were opened.
First, I thought there is a limit on the file size, but then I realized two different solutions are truncated and one is 1,348 KB and the other one 992 KB. So it mustn't be due to a file size limit.
Thank you for your help.
Here is how I write the variable in the file:
fileID = fopen('MATLAB_MSOL.txt', 'w');
Solution = char(M_sol(1));
fprintf(fileID, '%s\n','mu33_1 = ', Solution);
fclose(fileID );
0 Comments
Accepted Answer
VBBV
on 22 Jul 2023
Edited: VBBV
on 22 Jul 2023
fprintf(fileID, '%50s\t %50s\n','mu33_1 = ', Solution);
Since you want to print *mu33_1* and *Solution* as characters to the file , you will need n additional format specifier. You need to use as many format specifiers as the number of characters to print in the file to avoid truncation
More Answers (0)
See Also
Categories
Find more on String Parsing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!