Saving and attaching figure
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
TARUN
2025-2-28
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
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.
TARUN
2025-2-28
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!