how to use function to output code to control GUIDE
이전 댓글 표시
In my GUIDE, user can adjust number and then the display item will change.
I have already wrote a code like this:
for i=1:maxnumber
k1=eval(['handles.TD',num2str(i),'X']);
k2=eval(['handles.TD',num2str(i),'Y']);
k3=eval(['handles.TD',num2str(i),'R']);
k4=eval(['handles.TD',num2str(i),'AMP']);
k5=eval(['handles.TD',num2str(i),'CD']);
set(k1,'visible','on');
set(k2,'visible','on');
set(k3,'visible','on');
set(k4,'visible','on');
set(k5,'visible','on');
end
The key is last four "set" statement.
Now I want to write a function so I don't need to type this every time.
The code for function is the same as above.
But how can I use function to output "set" statement to control GUIDE?
Also, I found out I cannot use handles in function....is there a solution?
댓글 수: 1
@herb: using eval is not a good way to achieve this, as the blogs, documentation, and this forum have explained multiple times before:
etc, etc
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Debugging and Improving Code에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!