I'm trying to get the Save/Load command to use a variable as the path in octave/matlab I can save variables using the Save/Load command
save('/tmp/a1_var.mat','V1','V2')
But the path I use will change based on the location of the file. How can I have the save/load command accept variables for the path/and or filename?
Example:
dirpath='/tmp/';
save(dirpath,'a1_var.mat','V1','V2')
I tried
save(strcat(dirpath),'a1_var.mat','V1','V2')
but I get an error save: unable to open output file
save(strcat(dirpath,'a1_var.mat'),'V1','V2')
? I thinkfullfile
might be safer instead ofstrcat
. – Divakar