Update multiple objects Position(2) at once
Afficher commentaires plus anciens
Hello,
I want to update at once all the Position(2) of some graphic objects that are on different tiles of a same figure.
I am not sure what would be the best way - I assume using a loop would work but is not ideal. I wish I could use the linkprop function, but so far I have been able to use it only to link the complete position, instead of linking only the second element of Position.
I also have tried to use arrayfun to edit only the second element of position, but my objects are stored in a graphic array that has empty elements bacause there are not the same number of object per tile.
Here is a simplified example of my problem. I would like to change all the T.Position(2) at once:
% preallocate arrays to store my future objects
T = gobjects(3,4);
ax = gobjects(1,3);
f = figure(1);
t = tiledlayout(3,1);
for i = 1:3
ax(i) = nexttile; hold on;
plot([0 10],[1 5]);
for j = 1:i
T(i,j) = text(ax(i), j*2, 1, 'X'); % <-- objects which position needs to be updated later
end
end
Any thoughts or ideas are welcome, including suggestions concerning how to store my objects in a better way! Thank you!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
