For very long solution result Workspace doesn't show the full answer

Hello all,
I am new the Matlab online and using Matlab online Standard.
I have a system of equations which I solved on Matlab on line. The result comes back with answers for the variables. However, the answer is very long, so as I scroll down, eventually it shows "..." in the output window. So then I went into my Workspace view and I click on the solution which then shows the individual variables. When I click on those, again I scroll down for a while and then it shows "...". In the desktop version of Matlab from the Workspace view, I can see the result.
I couldn't find out whether there is any restriction on the length of the solution that Matlab will display with the Matlab Standard version. Can anyone give me feedback on this.
Thanks.

5 Comments

What is the length of your data? I am able to see a variable with 1 million rows in the the Variable view in MATLAB Online.
There are 304051 characters in the output. Roughly 100,000 expressions like below.
eg:
x3 = -(1.0*(1.0*a32**3*cx**2*cy**4*su**3*xpp1 - a32**3*cx**2*cy**4*su**3*xpp2 - a32**3*cx**3*cy**3*su**3*ypp1 + 1.0*a32**3*cx**3*cy**3*su**3*ypp2 - a31**2*cx**5*f*su*sv**3*ypp1 + 1.0*a31**2*cx**5*f*su*sv**3*ypp2 - a32**3*cx*cy**4*su**3*xpp1*xpp3 + 1.0*a32**3*cx*cy**4*su**3*xpp2*xpp3 - a31**2*a32*cx**4*cy**2*sv**3*xpp1 + 1.0*a31**2*a32*cx**4*cy**2*sv**3*xpp2 -
After the solution runs, I click on the WORKSPACE tab and it brings up a variable with my solution as: sol
I double click on sol and it shows the variables, eg: x1,x2,x3, ...
Then I double click on one of the variables and it opens a new tab eg: sol.x1
I scroll down the sol.x1 tab and eventually it stops scrolling and ends with "..."
However in the desktop version of Matlab when I run this, I scroll down and it shows the entire solution
I am just rerunning Matlab solver now and will post the screen shot.
Thanks !
See work space output.
I have show in red arrow where it shows the "..."
What are you hoping to do with a display of this very long symbolic (I'm assuming) expression?
I opened Microsoft Word and typed (copied and pasted) the letter b until I had one full page. It had just over 3k letters. So if your expression has 304051 characters that's about 100 pages.
Are you planning to read the whole thing? Are you trying to spot check for the presence or absence of certain sub-expressions?
I transcribe the results into my C++ program to make certain calculations using the general symbolic solution. 100,000 expressions on a 1.8 Ghz processor takes 10^5 / 1.8 x 10^9 ~ 1 x 10-4 seconds or ~0.1 milliseconds. The 100 pages of size is about 1 mb of character space. So it's not an issue.

Sign in to comment.

Answers (1)

Rather than trying to read 100 pages of text, a couple of options that may suit your needs:
  • call the ccode function
  • convert the symbolic expression into an char array and write it to a file using low-level file I/O functions like fopen, fprintf, and fclose
  • call the matlabFunction function and copy and paste the code (which may have more simplifications than the ccode output, I'm not certain) from the MATLAB function file into a C++ source file.
  • Call MATLAB functions from C++

1 Comment

Be careful with matlabFunction . It is very useful for converting symbolic expressions into numeric code, and it can write the result to a file. However by default when you write to a file, optimization is turned on.
Optimization can be quite slow: peformance is worse than propotional to the square of the number of elements in the expression.
But more of a problem is that historically in recent versions, optimization has had significant bugs. (I have not experimented with the current version.)
So if you use the 'file' option of matlabFunction(), be sure to turn optimization off (for now anyhow.)

Sign in to comment.

Products

Release

R2022b

Asked:

on 3 Feb 2023

Commented:

on 3 Feb 2023

Community Treasure Hunt

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

Start Hunting!