Info
This question is closed. Reopen it to edit or answer.
"Clear" function is not evaluated properly once program converted to exe
1 view (last 30 days)
Show older comments
I have created an executable from my GUI program. However, I have used a line to clear from matlab memory old files:
clear function
While working in Matlab environment, everything is ok. However, once converted to executable the program does not properly evaluates that line. I can see this, because executable produces the same results for the loop, meaning that program keeps executing "function", while in Matlab environment that function is overwritten by a new function.
Does anybody knows how this issue could be solved?
1 Comment
Jan
on 14 Mar 2013
It is not clear, when "function" means your function name, and when it means the term function. Did you use clear YourFuncName or is it a typo and you want clear functions with a trailing 's'?
Answers (1)
Jan
on 14 Mar 2013
You want a deployed function to write an M-function dynamically and evaluate it? What is exactly the difference between deployed and not-deployed functions then? Does this mean that it is trivial to emulate a locally installed Matlab just by a deployed tool, which write M-files dynamically and executes them? This would be rather strange and smell like a massive copyright problem, when running deployed code is allowed without owning a Matlab version. But perhaps I misunderstood something.
The most efficient way to solve this is to avoid the dynamic creation of M-files strictly. This would be a good idea for different reasons, e.g. to reduce the complexity, to allow for an easier debugging and to increase the efficiency.
2 Comments
Jan
on 18 Mar 2013
The deployed code should be able to create the M-file. I'd expect, that this M-file cannot be interpreted, but the deployed code runs only the M-files, which have been existing during the procedure of deployment - but this assumption could be wrong, although anything else would be rather strange.
How do you see, that the M-files are not created? Did you specify a folder where to save them?
Again I strongly recommend not to create M-code dynamically, because such meta-programming is a bad programming pattern. As you see, it causes more troubles than it solves.
This question is closed.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!