Equation in the exported text file is truncated
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
VBBV
2023-7-22
编辑:VBBV
2023-7-22
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String Parsing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!