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

95 ビュー (過去 30 日間)
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.

採用された回答

Star Strider
Star Strider 2018 年 9 月 10 日
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.
  7 件のコメント
Hassan Alkomy
Hassan Alkomy 2018 年 9 月 17 日
Thank you very much. I appreciate your help. Your suggestion solved the problem.
Celso Júnior
Celso Júnior 2021 年 7 月 12 日
Hi ! Did you use what option? the first ou second?

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 9 月 11 日
編集済み: Walter Roberson 2018 年 9 月 11 日
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.
Workaround
Increase the value of the parameter TEXTWIDTH by using this command.
evalin(symengine, "TEXTWIDTH := 2^31-1");

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by