How can I plot data in a existing figure?
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi All,
I am trying to add some data to an existing figure that I load in my script. A simplified example:
Test = open('Test.fig');
figure(Test)
hold on
A = 1:1:100
B = 0:0.02:1.98
plot(A,B)
However, this doesn't give the expected results as it overwrites the opened figure. Removing the 'hold on' makes the opened figure remain active but the line is not added and is nowhere to be found. I have been playing with hgload and copyobj as well but I didn't get it to work.
Any suggestions?
Thanks, Mark
8 commentaires
Thomas
le 12 Juil 2013
Modifié(e) : Thomas
le 12 Juil 2013
I dont think you understand.. its not overwriting.. its covering it with the new plot( since you are plotting the same identical thing) If you plot something else it will show two different line on the same figure as
Test = open('Test.fig');
figure(Test)
pause(2) %pause for you to see that it is bringing ur fig up
hold on
A = 1:1:100
B = 0:0.01:0.99
plot(A,B,'*','color','r')
Réponses (1)
Image Analyst
le 13 Juil 2013
I'm not sure what comes back when you save a figure as a .fig format file and then recall it. I'd save the data into a .mat file instead and then re-create your figure, after reading in the mat file, by plotting all the old data and annotations, then adding your new stuff.
0 commentaires
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!