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!