Clearing Issues With GUI
조회 수: 3 (최근 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
채택된 답변
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
추가 답변 (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!