Matlab using Maple symbolic engine suddenly and oddly don't run in certain loop.
Show older comments
for i=1:1000
Firstly, my code can successfully run through loop.
But, at a certain i, such as i = 137 or 152 and so on, the problem is occur, that is
- the program seems like paused, the 'command window' no longer output value of variables which successfully output in the same previous loop.
- And when I try to pause the program using 'pause' button but the 'pausing' always shows, no response, even though after 12 hours or more.
- Meanwhile, the CPU occupied by Matlab is zero when getting into trouble.
- There is another odd thing, when I use 'Run and Advance' for this same code, the code sometimes run well, no bad thing happens, however, sometimes the problem occurs as usual.
So, What the problem is? And does it caused by Maple symbolic engine? Because when I use MuPAD there is no such problem.
Matlab 2017a and Maple 2018.
3 Comments
Steven Lord
on 10 Nov 2019
It's going to be difficult if not impossible to offer any suggestions without seeing a small segment of code that we can try to run to reproduce the behavior you're seeing.
zhang sifei
on 13 Nov 2019
zhang sifei's "Answer" moved here:
I think the cause of this problem may occurs here

The wrong code is
T(i,1)=T(i,1)+w*(u(j,1)-u(i,1))*v*f;
and the sym/subsasgn (line 64) is

Does anybody tell me how to solve it?
Answers (1)
Walter Roberson
on 26 Nov 2019
B_=eval(B);
You should never eval() a symbolic expression. The internal language used by the character representation of symbolic expressions is not the language of MATLAB itself, and is not the the internal symbolic toolbox language. This is true for both the Maple based symbolic engine and the later MuPAD based symbolic engine.
You should instead subs() for any variables you want to replace with values from the workspace, and possibly double() the result to make it numeric.
6 Comments
Walter Roberson
on 26 Nov 2019
T(i,1)=T(i,1)+w*(u(j,1)-u(i,1))*v*f;
does not appear in any of the code you posted, so it is difficult to say what might be happening.
zhang sifei
on 26 Nov 2019
Walter Roberson
on 26 Nov 2019
I do not have a MATLAB with Maple installed with it handy, but I suspect that you should be using
B_ = double(B);
However, the problem occurs when the code runs here.
I think you have overlooked the point that the line of code you refer to is not anywhere in what you have posted, so we volunteers have no idea where in the code it appears or what else might be happening near there.
zhang sifei
on 4 Dec 2019
Walter Roberson
on 4 Dec 2019
I do not know what is wrong. I would guess that it hung inside of Maple for some reason.
zhang sifei
on 4 Dec 2019
Categories
Find more on Common Operations 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!

