workspace
by Bruno Luong
23 Feb 2009
(Updated 27 Feb 2009)
create and manipulate variable names in the target workspace by using strings
|
Watch this File
|
| File Information |
| Description |
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. |
| MATLAB release |
MATLAB 7.3 (R2006b)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 23 Feb 2009 |
Correct bug
New feature : workspace references with comma sign (':') |
| 24 Feb 2009 |
Possibly clearing selected variables with regular expression and wildcard |
| 27 Feb 2009 |
Use java containers for backward compatible
The new version run under 2006B (tested)
It also run on 2008B, 2009A
Not tested on other versions |
|
Contact us at files@mathworks.com