add path in matlab folder

1 次查看(过去 30 天)
Lavanya M
Lavanya M 2016-4-21
回答: Guillaume 2016-4-21
How to add(save as) path in matlab folder after writing program.The path is getting saved as user path.what do I do..??

回答(2 个)

Brattv
Brattv 2016-4-21
编辑:Brattv 2016-4-21
Hi, Try using the "cd" function to change the current folder
if true
% Changing folder to desktop before saving figure(1)
cd('C:\Users\....\Desktop')
saveas(figure(1),'png')
end
  1 个评论
Guillaume
Guillaume 2016-4-21
No! Avoid using cd at all cost. Much better to specify the full path of the file to save.
If you cd functions that were previously visible to matlab may not be accessible anymore and new ones may be visible.

请先登录,再进行评论。


Guillaume
Guillaume 2016-4-21
Just specify the path with the filename. You can use fullfile to build the full name:
saveas(hfig, fullfile('C:\folder\where you want\to save', 'somename.png');

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by