Output truncated. Text exceeds maximum line length for Command Window display. How to solve?

180 views (last 30 days)
I have a problem that when I tried to display an answer, I got this message (Output truncated. Text exceeds maximum line length for Command Window display). I know that this is because the answer is too long.
My problem exactly is:
I need to do further processing on the result of f3Up. Exactly, I need to do two things:
1) Replace y1 to be y(1), then do the same thing for y2, y3, ... y10.
2) Replace the multiplication * to be .* and the same for / and ^ to make an element wise process.
I used to display the result, copy it, paste in a new file and then use the command (Replace) to do these two modifications I mentioned above. Now, I cannot display the full result, so I cannot do these modifications.
Can anyone help me with that.
I am using Matlab 2018a and this is an example of f3Up after shortening and deleting a lot of terms just to see what I want to do.
f3Up =(y1*cos((4014731262101775*t)/17592186044416)+5886768972981423*(((110680464442257306357*(44*pi)/5))/36893488147419103232000000 - sin... Output truncated. Text exceeds maximum line length for Command Window display.
Thanks in advance.

Accepted Answer

Star Strider
Star Strider on 10 Sep 2018
The only options I can think of are:
f3Up = simplify(f3Up, 'Steps',20);
f3Up = vpa(f3Up, 5)
The first will do its best to simplify the function, by collecting terms and other operations, and the second replaces the long fractions by truncated decimal fractions, without losing any internal precision.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 11 Sep 2018
Edited: Walter Roberson on 11 Sep 2018
In a couple of releases, there was a bug where \r and \n characters could end up in the displayed output. There was a work-around for that, and there is a possibility that it might also affect the point at which output is truncated like you are observing.
Note, though, that the truncated bit is only for display purposes, and does not affect what is stored, so you should be able to store the results to a variable and manipulate it -- just don't use the copy/paste workflow (consider using matlabFunction or subs instead). There is also a way to get the symbolic engine to write out the MuPAD representation of an expression to a text file.
Increase the value of the parameter TEXTWIDTH by using this command.
evalin(symengine, "TEXTWIDTH := 2^31-1");

Community Treasure Hunt

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

Start Hunting!