- Open the Scope block and navigate to Settings.
- Go to the Logging tab.
- Enable Log data to workspace.
- Set the Variable Name to “simout” and the Save Format to Structure with time.
cannot save figure from simulink
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
whenever i try to save a plot generated from the simulink it is saved as an emty handle. and i get the following error 
i am using 2016a version.

Warning: While saving an object of class 'matlabshared.scopes.UnifiedScope':
Method 'saveobj' is not defined for class 'matlabshared.scopes.UnifiedScope' or is removed from MATLAB's search path. 
> In matlab.graphics.internal.figfile.FigFile/write (line 32)
  In savefig (line 84)
  In saveasfig (line 6)
  In saveas (line 140)
  In filemenufcn>localSaveExportHelper (line 216)
  In filemenufcn>localSaveExport (line 344)
  In filemenufcn (line 56)
  In filemenufcn>localSave (line 186)
  In filemenufcn (line 54)
Warning: Simulink.BlockDiagram object could not be saved in a MAT-file. It will be saved as an empty handle instead. 
> In matlab.graphics.internal.figfile.FigFile/write (line 32)
  In savefig (line 84)
  In saveasfig (line 6)
  In saveas (line 140)
  In filemenufcn>localSaveExportHelper (line 216)
  In filemenufcn>localSaveExport (line 344)
  In filemenufcn (line 56)
  In filemenufcn>localSave (line 186)
  In filemenufcn (line 54) 
Warning: Figure is saved in C:\Users\praween\Desktop\untitled.fig. Saving graphics handle variables can cause the creation of
very large files. To save graphics figures, use savefig. 
> In matlab.graphics.internal.figfile.FigFile/write (line 32)
  In savefig (line 84)
  In saveasfig (line 6)
  In saveas (line 140)
  In filemenufcn>localSaveExportHelper (line 216)
  In filemenufcn>localSaveExport (line 344)
  In filemenufcn (line 56)
  In filemenufcn>localSave (line 186)
  In filemenufcn (line 54) 
댓글 수: 0
답변 (1개)
  Vedant Shah
 2025년 3월 12일
        To save a plot generated using the ‘Scope’ block in a Simulink model, certain properties of the Scope block must be modified. Follow these steps to adjust the necessary settings: 
Once the simulation is complete, execute the following commands in the MATLAB command window to save the figure: 
time = simout.time; 
data = simout.signals.values; 
plot(time, data); 
saveas(gcf, 'myPlot.png'); 
For additional details, refer to the official MATLAB documentation using the following commands: 
web(fullfile(docroot, '/simulink/slref/scope.html')) 
web(fullfile(docroot, '/matlab/ref/saveas.html')) 
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

