Basic question about loops
1 ビュー (過去 30 日間)
Very basic question: why is this not working?
The error is: Unable to perform assignment because the left and right sides have a different number of elements.
millercommamatt 2021 年 10 月 29 日
You could make use of genvarname, but this would work too.
for i = 2:5
eval(['Idx' num2str(i) ' = Idx(:,' num2str(i) ');']);
When you start using functions like genvarname and eval, it's usually a sign that you should be approaching your task in a different way.