Trinh @ Bath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
it_matlab_figures [2024/03/23 23:28]
trinh
it_matlab_figures [2024/03/23 23:33] (current)
trinh
Line 3: Line 3:
 You may be using Matlab to create graphics. Some considerations: You may be using Matlab to create graphics. Some considerations:
  
-  - Save all data or all scripts. Get in the habit of save data as `.matfiles and scripts that will plot the data. This means if you ever need to regenerate pictures, you can do it very easily.+  - Save all data or all scripts. Get in the habit of saving data as ''%%.mat%%'' files.  
 +  - Create scripts that will load in ''%%.mat%%'' files and plot the data. This means if you ever need to regenerate pictures, you can do it very easily
 +  - Similar to above, you may want to save ''%%.fig%%'' files of the pictures. Again, it allows fine-tuning. (In fact, you can extract raw data from ''%%.fig%%'' files via scripts if you look into it). To save such a file, simply click File > Save-As on the figure window. 
 +  - Use [[https://uk.mathworks.com/matlabcentral/fileexchange/23629-export_fig|export_fig]] package (Matlab file exchange) to export to pdf format. In general, output to PDF format unless the image is very detail-heavy (surface plots, contour plots, etc.). This ensures that the image is scalable and crisp
  
-  - Similar to above, you may want to save `.fig` files of the pictures. Again, it allows fine-tuning. (In fact, you can extract raw data from .fig files via scripts if you look into it). +Once you have downloaded the ''%%export_fig%%'' packageunzip it and move the folder into a unified functions folder on your computerRefer to the [[it_matlab_startup|startup.m]] guideBy doing soyou can issue a command like
- +
-  - Use [[https://uk.mathworks.com/matlabcentral/fileexchange/23629-export_fig|export_fig]] package (Matlab file exchange) to export to pdf formatIn generaloutput to PDF format unless the image is very detail-heavy (surface plots, contour plots, etc.). This ensures that the image is scalable and crisp. +
  
-Once you have downloaded the `export_fig` package, unzip it and draw the folder into a unified functions folder on your computer. Refer to the [[it_matlab_startup|startup.m]] guide+<code matlab> 
 +export_fig 'test.pdf'  
 +</code>
  
 +in order to produce a PDF of the currently targetted figure.