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

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

 Respuesta aceptada

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 comentarios

Yes you point the right mistake of path... ur code works according to my requirement. Thanks
You are quite welcome.
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Programmatically en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Etiquetas

Preguntada:

el 27 de Oct. de 2023

Comentada:

el 28 de Oct. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by