GUI, Handles saved in variable

1 visualización (últimos 30 días)
Michal Demjan
Michal Demjan el 25 de Sept. de 2016
Respondida: Image Analyst el 25 de Sept. de 2016
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

Respuesta aceptada

Stephen23
Stephen23 el 25 de Sept. de 2016
Editada: Stephen23 el 25 de Sept. de 2016
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 comentario
Michal Demjan
Michal Demjan el 25 de Sept. de 2016
Oh i didnt realized that it is struct. Thanks a lot!

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 25 de Sept. de 2016
Try
handles.pushbutton1.BackgroundColor = [0, 1, 0];

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by