Problem in output. Output Truncated. Text exceeds maximum line length of 25,000 characters for Command Window display
37 views (last 30 days)
Show older comments
I am facing a problem " Output truncated. Text exceeds maximum line length of 25,000 characters for Command Window display.." The code I am working with is :
syms x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12
m=[3452.4 3452.4 3819.4 2652.4 2652.4 2986.1 2652.4 2652.4 2986.1 1809.9 1809.9 2056.9];
m1=eye(12,12);
for i=1:12
M(i,i)=m(1,i)*m1(i,i);
end
k1xd=106.6; k2xd=106.6; k3xd=106.6; k4xd=106.6;
k1yd=67.9; k2yd=x1*67.9; k3yd=67.9; k4yd=67.9;
k1zd=232.02; k2zd=232.02; k3zd=232.02; k4zd=232.02;
Kd=10^6*[k1xd+k2xd 0 0 -k2xd 0 0 0 0 0 0 0 0;
0 k1yd+k2yd 0 0 -k2yd 0 0 0 0 0 0 0;
0 0 k1zd+k2zd 0 0 -k2zd 0 0 0 0 0 0;
-k2xd 0 0 k2xd+k3xd 0 0 -k3xd 0 0 0 0 0;
0 -k2yd 0 0 k2yd+k3yd 0 0 -k3yd 0 0 0 0;
0 0 -k2zd 0 0 k2zd+k3zd 0 0 -k3zd 0 0 0;
0 0 0 -k3xd 0 0 k3xd+k4xd 0 0 -k4xd 0 0;
0 0 0 0 -k3yd 0 0 k3yd+k4yd 0 0 -k4yd 0;
0 0 0 0 0 -k3zd 0 0 k3zd+k4zd 0 0 -k4zd;
0 0 0 0 0 0 -k4xd 0 0 k4xd 0 0;
0 0 0 0 0 0 0 -k4yd 0 0 k4yd 0;
0 0 0 0 0 0 0 0 -k4zd 0 0 k4zd];
[evecx,evalx]=eig(inv(M)*Kd);
Evx=vpa(evecx)
Evax=vpa(evalx)
How can I solve this problem??
4 Comments
Steven Lord
on 21 Jan 2020
The general rule of thumb I've found on Google is that one single-spaced page of text contains about 3000 characters. So your expression, printed out, would take at least eight pages.
What you are hoping / planning to do with the result of that expression? That may help us determine how you can achieve your goal without trying to display such a long expression.
Accepted Answer
Sindar
on 20 Jan 2020
Instead of displaying the results and copying, print them directly to a file. The best format depends on how you will be working with the data later, but CSV is often a good choice (most everything can read it).
Evx=vpa(evecx);
Evax=vpa(evalx);
writematrix(Evx,'Evx.csv')
writematrix(Evax,'Evax.csv')
Then, you will have your data saved in the files (in your current directory)
6 Comments
Sindar
on 20 Jan 2020
Whoops, my bad. I somehow didn't process that you were trying to print a symbolic expression. In that case, you just want text:
Evx=vpa(evecx);
Evax=vpa(evalx);
my_stream = fopen('Evx.txt','w');
fprintf(my_stream,'%s',Evx);
fclose(my_stream);
my_stream_a = fopen('Evax.txt','w');
fprintf(my_stream,'%s',Evax);
fclose(my_stream_a);
More Answers (1)
Walter Roberson
on 21 Jan 2020
You need a function similar to the below in order to write the symbolic expression to a file for further processing.
Note that the result will be in MuPAD expressions, not in MATLAB expressions. There will be differences in matters such as how matrices are represented, and how sqrt(-1) is represented.
function symwrite(expression, filename)
feval(symengine, '_assign', 'TemporaryName', expression);
cmd = sprintf('fid := fopen("%s", Write, Text); fprint(fid, TemporaryName); fclose(fid);', filename);
evalin(symengine, cmd);
Note:
I give this code to you as a deliberate exercise in futility. It will do what you ask, presenting you with a readable version of your long expressions. You will almost certainly find that having the readable version of the long expressions is useless to you. However you are unlikely to believe any of us on that point until you have seen for yourself just how useless having the full expression is.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!