Borrar filtros
Borrar filtros

Hot to change the settings of multiple gui components at the same time

3 visualizaciones (últimos 30 días)
Hello,
I have a programmatically written gui. Their units are in pixels. After writing everything in pixels, I wanted to set all the units to normalized. I don't want to do it one by one. Do you know how I can set to normalized for multiple handles at the same time?
Thank you,
Emre

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 10 de Ag. de 2012
Okay:
handles = struct('h1',pi,'h2',3,'edit1',17); %exmaple handles
set(cell2mat(struct2cell(handles)),'somefield',some_value);
  3 comentarios
Sean de Wolski
Sean de Wolski el 10 de Ag. de 2012
You can't have the '.' in the field name of a struct. It looks lik eyou probably want:
tobenormalized=struct('text',handles.text);

Iniciar sesión para comentar.

Más respuestas (2)

Matt Fig
Matt Fig el 10 de Ag. de 2012
Pass in a vector of the handles:
u(1) = uicontrol;
u(2) = uicontrol;
u(3) = uicontrol;
set(u,'units','norm')
  5 comentarios
Addy
Addy el 9 de Mayo de 2018
In that case, something like this would be easiest of all!
set(findall(gcf,'units','pix'),'units','norm')
OMG. Thank you very much for this. I finally found this gold after 5 hours of madness :^)
Kevin Phung
Kevin Phung el 25 de Mzo. de 2019
Editada: Kevin Phung el 25 de Mzo. de 2019
ditto that!! That's one beautiful line. Thanks @Loginatorist

Iniciar sesión para comentar.


Seyhan Emre Gorucu
Seyhan Emre Gorucu el 10 de Ag. de 2012
Thank you guys for the answers.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by