GUI, Handles saved in variable

1 次查看(过去 30 天)
well in simple, i wrote:
A=['handles.',get(hObject,'Tag')];
set(A,'Backgroundcolor',[0,1,0]);
or
A='handles.pushbutton1';
set(A,'Backgroundcolor',[0,1,0]);
and function 'set' cannot read that A, can you help me? Uncle MATLAB says :
Error using set
Value must be a handle

采纳的回答

Stephen23
Stephen23 2016-9-25
编辑:Stephen23 2016-9-25
Why are you trying to construct a string? If you have a structure, then do this:
A = handles.(get(hObject,'Tag'));
And read this:

更多回答(1 个)

Image Analyst
Image Analyst 2016-9-25
Try
handles.pushbutton1.BackgroundColor = [0, 1, 0];

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by