Saving Plots in Matlab - A Beginner's Guide

  • Context: MATLAB 
  • Thread starter Thread starter MaxManus
  • Start date Start date
  • Tags Tags
    Matlab Plot
Click For Summary
SUMMARY

This discussion focuses on saving plots in MATLAB, specifically for beginners looking to export multiple plots to different files. The user attempted to use the command print('-dpdf','plot n = %s'n), which resulted in an error due to incorrect syntax. The correct approach involves consulting the MATLAB documentation for the print function and ensuring that plots are resized appropriately to avoid pixelation. Users are advised to consider vector output options for better quality.

PREREQUISITES
  • Basic understanding of MATLAB syntax and commands
  • Familiarity with MATLAB plotting functions
  • Knowledge of file formats for exporting plots (e.g., PDF, vector output)
  • Experience with resizing figures in MATLAB
NEXT STEPS
  • Review the MATLAB documentation for the print function
  • Learn how to resize figures in MATLAB before exporting
  • Explore options for exporting plots in vector formats
  • Practice creating and saving multiple plots in a loop
USEFUL FOR

Beginner MATLAB users, data analysts, and anyone interested in exporting high-quality plots from MATLAB.

MaxManus
Messages
268
Reaction score
1
Hey, I am making some plots in a loop and I want to save the different plots in different files.

I am new to Matlab so I don't know what to do, I tried the command

print('-dpdf','plot n = %s'n)

,but that was an 'Unexpected MATLAB expression.'
 
Physics news on Phys.org
Take a look through the pertinent MATLAB documentation page:
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/print.html

(Exporting to various formats is about half-way through).

Note that you should probably resize the plot (to, say, Letter or A4 size) prior to exporting, otherwise things may look rather pixellated (though there is an option for vector output).
 
Thanks.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K