MATLAB: Create workspace file automatically.

workspace

Let's say I have:
a = {'one' 'two' 'three'};
b = [1 2 3];
I want each word create a file in workspace automatically and equal to number. Like:
one=1; two=2; three=3;

Best Answer

I think you mean "variable," not "file." Right?
for ii = 1:numel(a)
eval(sprintf('%s = %d',a{ii},b(ii)));
end
Cheers,
Brett