How to save statitiscs displayed in workspace as text file?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Is there a way to save the statistics displayed on workspace
as a text file (as if I would record an image of workspace)?
IMPORTANT: I don't to save the workspace by the command
save ('FILENAME', 'VARIABLE', 'VARIABLE',...)
Thank you
Emerson
2 Commenti
Paulo Silva
il 20 Apr 2011
What do you mean by "statistics displayed in workspace"?
What classes are involved? class(variable)
Risposta accettata
Matt Tearle
il 20 Apr 2011
Do you mean you want a list of variable names, sizes, classes, bytes used,...? If so, you could do vars = whos, then save/write the result.
EDIT TO ADD:
To write to a text file
fid = fopen('variable.log','wt');
vars = whos
for k=1:length(vars)
fprintf(fid,'%s %s %s %u\n',...
vars(k).name,mat2str(vars(k).size),vars(k).class,vars(k).bytes);
end
fclose(fid);
BUT, if the default output from whos is what you want, the simplest approach is probably:
diary('variable.log')
datestr(now)
whos
diary off
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!