Text exceeds maximum line length of 25000 characters

15 views (last 30 days)
Hi I have written some codes in Matlab, some parameters (which have symbolic values) are calculated by that mfile. Since their length is more than 25000 character, command window doesn't show them completely. Would you please help me how to access these values? Best regards.

Accepted Answer

Walter Roberson
Walter Roberson on 9 May 2012
The symbolic engine has file I/O facilities that could be used to write out the expression.
Perhaps for your purposes, using vpa() on the expressions would be suitable? That would collapse most rational constant expressions into decimal.
simplify() might be able to create a shorter expression for you... but the shorter expression might still be too long.
You can also break apart expressions using the symbolic operator "op", which there is no MATLAB interface to. You have to be careful to extract the name of the operator itself. For example,
a + b + c
is stored inside the symbolic engine as the expression
_plus(a, b, c)
and op 1 of the expression would be the "a" part, not the _plus part: the _plus part is op 0.
  2 Comments
frank
frank on 9 May 2012
Thanks for your answer, but I didn't get what should I do exactly.
I can't understand how can I break apart an expression that I can't access it and I even don't know its form.
could you please guide me how to do it?
Walter Roberson
Walter Roberson on 9 May 2012
The restriction of 25000 is on what can be displayed at the command window, not on the size of the symbolic expression itself. Store the symbolic expression in a variable, and then you can break it apart.
numop = feval(symengine, 'nops', TheVariable);
ops = cell(1,numop+1);
for K = 0 : numop
ops{K+1} = feval(symengine, 'op', TheVariable, K);
end
Then ops{1} would be the name of the operator (as known by the symbolic engine), ops{2} would be the first argument, ops{3} the next, and so on.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!