I have a workspace with 30 variables, all sized 8x1.
I would like to save all of them in a .txt file, including their name.
The command I am using is:
save( 'filename.txt' , '-ASCII' );
It saves the variable values as intended, but not the variable names alongside their values.
Any help would be most welcome! Thank you in advance!
myfilepath = 'C:\myfile.txt';
fid = fopen(myfilepath, 'wt');
fprintf(fid, '% this is the beginning of my file');
fprintf(fid, 'var1 = %d ',evalin('base',var1)); % if var1 is double
you can use "whos" to find what variables u have in base workspace...