Clearing Issues With GUI

3 次查看(过去 30 天)
Adam Cutbill
Adam Cutbill 2011-1-28
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?

采纳的回答

Jan
Jan 2011-1-28
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by