How to auto save workspace variable with specific path and filename without Popup?

1 次查看(过去 30 天)
d = 'Sunday'; y = 2017;
path = 'E:\Matlab\';
filenam = 'Data';
% uisave({'d','w'},path) % this works with path but ask for filename
% uisave({'d','y'},filenam) % this works with filename but ask where to save
uisave({'d','y'},filenam,path) % i want to save this data without asking anything from user.
% if any other function can do desired task it would be acceptable

采纳的回答

Les Beckham
Les Beckham 2023-10-27
Have you tried using save?
For example:
d = 'Sunday'; y = 2017;
filepath = 'E:\Matlab\';
filename = 'Data';
save(fullfile(filepath, filename), 'd', 'y')
Also do not name a variable path. That is a very important built-in function in Matlab. Overloading that will break a lot of things.
  3 个评论
Les Beckham
Les Beckham 2023-10-28
Also, if you are just getting started with Matlab, I would highly recommend that you take a couple of hours to go through the free online tutorial: Matlab Onramp

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by