You can do that using eval
for ii = 1:size(DATA,1)
eval( [DATA{ii,1}, ' = ', num2str( DATA{ii,2} )] );
end
However, use of eval
is not recommended.
You can use dynamic field names instead:
s = cell2struct( DATA(:,2), DATA(:,1), 2 );
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…