Output truncated in Matlab

I am doing accounts in matlab and appear 'Output truncated.  Text exceeds maximum line length of 25.000 characters for Command Window display.'
I need to view the complete answer.
What can I do?
Is possible save the answer in *.txt before of the answer appear in the display?
I tried to use simplify and not was good enough.
I am using symbolic in the matlab.
Thanks...

2 commentaires

SymboliceEquation = ...%Here is your calculation;
f_sym = fopen('SymboliceEquation.txt', 'wt');
fprintf(f_sym, '%s\n', char(SymbolicEquation));
fclose(f_sym);
Note: char() of a symbolic expression does not generally result in a string that can be evaluated by MATLAB. char() of a symbolic expression is really only suitable for entering the expression back in to the symbolic toolbox.
Walter Roberson
Walter Roberson le 30 Mai 2017
Actually that will not work; it will result in a truncate display as well.

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 10 Avr 2014

0 votes

evalin(symengine, 'write', FileName, Yourvariable);

4 commentaires

JRC
JRC le 10 Avr 2014
Thank you Walter... but I don´t gave right...
I have big answers in the matlab and I need save each one them for to use in Maple.
What´s happening is that the Matlab don´t get to show the whole answer because the answer is very big. The answer don´t appear in the screen.
The answer is a matrix x(1), x(2), x(3),... or y(1),...
I am using symbolic in matlab and I work with dynamic programming. The dynamic programming to use very memory and the calculation (and answers) are very large.
I my calculation, I use the function simplify but still is very big the answer.
An example is the answers of the code below...
t = 10; J(t+1)=0;
for N=t:-1:1
sis1 = (lambda)*x(N)-0.0466*y(N); F = 8*x(N)^2+0.2841*y(N)^{2};
JJ(N) = subs(F + J(N+1), {x(N+1)},{sis1});
[p1(N)] = solve(JJ1(N), y(N));
J1(N) = subs(JJ(N), {y(N)}, {p(N)});
J(N) = simplify(J1(N));
end
The code is incorrect but is a ideia than I have do. Have others things how define syms, num2str, etc in the algorithm, that I don´t wrote here...
Where stay the comand 'evalin' in the algorithm?
Thanks again...
Walter Roberson
Walter Roberson le 10 Avr 2014
Are you using MuPAD as your symbolic engine, or Maple? If you are using Maple then are you using an older MATLAB in conjunction with the older Symbolic Toolkit, or are you using a stand-alone Maple and have had Maple install the MATLAB / Maple interface? If you are using old MATLAB with old Symbolic Toolkit then do you also have Extended Symbolic Toolkit (something that existed back then but does not exist now) ?
If you are using R2007a or earlier, then symengine did not exist and we will come up with a different call such as to maple(). If you are using R2007b or later then symengine does exist, but the best call into the symbolic engine to use will depend upon whether your symbolic engine is MuPAD or Maple.
JRC
JRC le 11 Avr 2014
I am using MudPAD and Matlab R2007b.
I do whole accounts in Matlab, and after I use the answers in Maple for do others things/accounts.
The accounts in Maple is a other step of my problem. The use of Matlab and Maple are independents.
Thanks again.
Walter Roberson
Walter Roberson le 11 Avr 2014
Modifié(e) : Walter Roberson le 30 Mai 2017
Okay, you should be able to put the call after the end of the loop, asking to write J. But checking again, feval() is the call rather than evalin()
You may wish to consider passing through generate::optimize as well:
feval(symengine, 'write', FileName, feval(symengine, 'generate::optimize', Yourvariable));
I am not completely sure that the generated arrays will be compatible with Maple; you should run a test case. I do not have MuPAD here to experiment with.

Connectez-vous pour commenter.

Question posée :

JRC
le 10 Avr 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by