The problem is not included inside "func(x,y,z) clear all x=5; y=5; z=5;", but in the other lines. You can use the PROFILEr to inspect where the function wastes the time. Afterwards you could post these lines and asked more specific again.
Clearing Issues With GUI
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm having issues when running a function from a Guide GUI pushbutton. When I call this function, from a script it runs very quickly. However, if it is called from the GUI , it is very slow. The function (which performs an iterative algorithm) starts very quickly after the press (i.e, I push the button and it begins instantly), but it runs slow. For example, with the script call it takes about 0.1 seconds to complete one iteration, while when called from the GUI it takes about 3 seconds.
I found out if I clear the variables, then re-declare them in the iterative function, it runs very quickly even when called from the GUI:
ie:
func(x,y,z)
clear all
x=5;
y=5;
z=5;
....
This of course defeats the purpose of passing parameters. I'm looking for a way to clear all and keep a few variables. Note, using the Keep function or clearvars except, won't work in this case. I think "Classes" is where I'm getting garbage, not in the variables, but there is no way to add exceptions to "clear classes". I've also tried save, clear, load, but no success. My next attempt is to save to .txt, clear, then load, but this seems inelegant. Any suggestions?
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!