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!
No products are associated with this question.
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 doublefclose(fid);
you can use "whos" to find what variables u have in base workspace...
1 Comment
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/54174#comment_112047
why don' t save them to mat file? is there any reason?