For very long solution result Workspace doesn't show the full answer
3 views (last 30 days)
Show older comments
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
Steven Lord
on 3 Feb 2023
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?
Answers (1)
Steven Lord
on 3 Feb 2023
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
Walter Roberson
on 3 Feb 2023
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.)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!