Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc; clear all
- vector13 = [1/3 2.1 3.1];
- vector31 = [1 2 3]';
- matrix33 = [11 12 13;...
- 21 22 23;...
- 31 32 33];
- scalar = 3;
- % Create a text file containing workspace variables.
- varNames = who; %List of variable names in workspace in alphabetical order.
- fileName = 'workspace.txt';
- delete(fileName);
- fid = fopen(fileName, 'a');
- for i=1:length(varNames)
- sizeOfVar = size(eval(char(varNames(i))));
- fprintf(fid, '%s : %s = ', char(varNames(i)), num2str(sizeOfVar, '%d, %d'));
- valStr = num2str(eval(char(varNames(i))),'%1.15f ');
- for iRow = 1:sizeOfVar(1)
- fprintf(fid, '%s ', valStr(iRow,:));
- end
- fprintf(fid, '\n');
- end
- fclose(fid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement