cannot extract data from figure with multiple lines
    1 Ansicht (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Nathaniel Goldfarb
 am 5 Apr. 2022
  
    
    
    
    
    Kommentiert: Fangjun Jiang
      
      
 am 6 Apr. 2022
            Hello, 
I have a matlab figure with muliple lines in it that I am trying to extact. However I can only get the figure line. I am not sure what is wrong. I created the figures in simulink
I am using the following code
fig = openfig('traj.fig');
h = findobj(gca,'Type','line');
y_no_humanX = get(h,'Xdata') ;
y_no_humanY = get(h,'Ydata') ;
close(fig);
when I try to extract the data I only get the first line and cannot get the other lines. I am not sure what is going on. 
Any ideas?
0 Kommentare
Akzeptierte Antwort
  Fangjun Jiang
      
      
 am 5 Apr. 2022
        
      Bearbeitet: Fangjun Jiang
      
      
 am 5 Apr. 2022
  
      The other two "curves" are created using stairs(). use findobj(fig,'Type','Stair') to find those.
fig = openfig('traj.fig');
>> findobj(fig)
ans = 
12×1 graphics array:
Figure         (ScopePrintToFigure)
UIContainer    (PrintLayoutGridContainer)
UIContainer    (PrintContainer)
Panel          (DisplayPanel1)
Legend         (ref, Subsystem/1, Subsystem/3)
Axes           (DisplayAxes1_RealMag)
Stair          (DisplayLine2)
Stair          (DisplayLine1)
Line           (DisplayLine1)
Transform
Transform
Transform
4 Kommentare
  Fangjun Jiang
      
      
 am 6 Apr. 2022
				If you have access to the Simulink model and simulation, you could save those data directly using the "To Workspace" block. 
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Creating, Deleting, and Querying Graphics Objects 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!