workspace
Now and then people want to load a file and assign them to a variable name with a meaning that reflects the data.
Up now Matlab users have many but two choices:
- using EVAL (evil)
- put the data burried inside a structure
Here is a third choice:
ws=workspace % class constructor
datastr='data1';
ws.(datastr)=load([datastr '.txt'])
plot(data1);
% Easy? No?
I'm almost sure there will be many protests to this submission.
Zitieren als
Bruno Luong (2024). workspace (https://www.mathworks.com/matlabcentral/fileexchange/23078-workspace), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
workspace/@workspace/
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.3.0.0 | Use java containers for backward compatible
|
||
1.2.0.0 | Possibly clearing selected variables with regular expression and wildcard |
||
1.1.0.0 | Correct bug
|
||
1.0.0.0 |