Filter löschen
Filter löschen

set property of graphicsobject in array before R2014b

1 Ansicht (letzte 30 Tage)
Manuel
Manuel am 30 Nov. 2017
Kommentiert: Manuel am 1 Dez. 2017
I have want to make my GUI compatible <R2014b (see https://de.mathworks.com/help/matlab/graphics_transition/graphics-handles-are-now-objects-not-doubles.html) Specifically, my question is how to write the following using set(object,value) since "." (dot) notation is not allowed...
handles.panel.children(4).position(3) = some value

Akzeptierte Antwort

Jan
Jan am 30 Nov. 2017
Bearbeitet: Jan am 30 Nov. 2017
pos = get(handles.panel.children(4), 'Position');
pos(3) = some value;
set(handles.panel.children(4), 'Position', pos);
Maybe it is easier to use this tool: FEX: DotNot, but I have not tested this yet.
  3 Kommentare
Jan
Jan am 1 Dez. 2017
As you can imagine, I do not know what is stored in "handles.panel". If this is a handles of a uipanel, you can apply the method I have showed you already instead of waiting, that someone else does it for you.
children = get(handles.panel, 'Children');
pos = get(children(4), 'Position');
pos(3) = some value;
set(children(4), 'Position', pos);
Do you see, how the dot-notation and get/set are related?
H.Prop = Value
% is equivalent to:
set(H, 'Prop', Value);
Value = H.Prop;
% is equivalent to
Value = get(H, 'Prop');
Manuel
Manuel am 1 Dez. 2017
...just wanted to point out, that the way it is written above it does not work. Thanks for your effort! much appreciated!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by