Saving and attaching figure

1 次查看(过去 30 天)
vani
vani 2022-11-2
评论: TARUN 2025-2-28
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?

回答(1 个)

TARUN
TARUN 2025-2-28
Hi @vani,
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 个评论
DGM
DGM 2025-2-28
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by