Hikul
Hikul

Reputation: 59

Saving a workspace variable to the path selected with uigetcontrol (MATLAB)

I have some code that begins with

[filename, pathname] = uigetfile('*.mat','Please select your data',...
'Multiselect','on');

and it goes on to calculate and store a variable in the workspace called "results".

I want to save "results" into the folder that the user selected their data from at the beginning, I've tried this:

save(pathname/'merge.mat');

and a few other things but I can't get it to work

Upvotes: 0

Views: 38

Answers (1)

R. Schifini
R. Schifini

Reputation: 9313

Try this:

save([pathname 'merge.mat']);

You need to concatenate the pathname string to 'merge.mat' and for that you must use square brackets [string1 string2].

Upvotes: 1

Related Questions