workspace

create and manipulate variable names in the target workspace by using strings
1,9K download
Aggiornato 27 feb 2009

Visualizza la licenza

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.

Cita come

Bruno Luong (2026). workspace (https://it.mathworks.com/matlabcentral/fileexchange/23078-workspace), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2006b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su File Operations in Help Center e MATLAB Answers

workspace/@workspace/

Versione Pubblicato Note della release
1.3.0.0

Use java containers for backward compatible
The new version run under 2006B (tested)
It also run on 2008B, 2009A
Not tested on other versions

1.2.0.0

Possibly clearing selected variables with regular expression and wildcard

1.1.0.0

Correct bug
New feature : workspace references with comma sign (':')

1.0.0.0