How can i loop through list of variable 'selected' in workspace to get and store in one matrix (h).
it only stores the last matrix using my code. please help
clearA=[1, 2, 3]'B=[3,4,5]'C=[3,7,9]' x=who selected={'A', 'B' 'C'}; m=length(selected)h=zeros(3,m) for cv = x y= eval(sprintf('%1$s', cv{m})) h(:,cv) = yend
%%Result
A=[1 3 3;2 4 7; 3 5 9]
Best Answer