Saving and attaching figure
1 view (last 30 days)
Show older comments
I saved my figure in the matlab server using 'saveas' option but I wanted to attach it to the email which I am not able to do it as it is saved inside the server and not in my desktop. How can I save the figure in my desktop and attach it to my email?
0 Comments
Answers (1)
TARUN
on 28 Feb 2025
I understand that you are aiming to save a figure directly to your desktop from the MATLAB server.
To accomplish this, you need to specify a path that points to your local machine.
Below is an example of how you can achieve this:
fig = figure;
plot(1:10, rand(1,10)); % Example plot
% file path to your desktop
filePath = 'C:\Users\YourUsername\Desktop\myFigure.png'; % Add your file path here
saveas(fig, filePath);
Replace “YourUsername” with your actual username on the system.
Once you run this code, the figure will be saved on your desktop, and you can attach it to your email.
You can refer to the following MathWorks documentation for more information on saveas function: https://www.mathworks.com/help/releases/R2022a/matlab/ref/saveas.html?searchHighlight=saveas&searchResultIndex=1
2 Comments
DGM
on 28 Feb 2025
The question is asking how to save a file from MATLAB Online to local storage on their computer. Using saveas() doesn't work for that.
See also the thread linked in the answer.
TARUN
on 28 Feb 2025
Thank you for correcting my answer.
@vani please have a look at https://www.mathworks.com/matlabcentral/answers/526406-when-using-matlab-online-is-it-possible-to-save-a-file-to-a-local-computer-drive that @DGM provided.
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!