workspace

版本 1.3.0.0 (5.5 KB) 作者: Bruno Luong
create and manipulate variable names in the target workspace by using strings
1.9K 次下载
更新时间 2009/2/27

查看许可证

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.

引用格式

Bruno Luong (2025). workspace (https://ww2.mathworks.cn/matlabcentral/fileexchange/23078-workspace), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2006b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 File Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

workspace/@workspace/

版本 已发布 发行说明
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