Error using a for-loop
1 次查看(过去 30 天)
显示 更早的评论
The following gives an error and I don't know why. The code runs perfectly when I leave '(i_testen)' away behind 'Enkel_hoek_afg'.
for i_testen=1:5
...
Enkel_hoek_afg(i_testen) = Enkel_hoek(1:Afg_c_RANK_RKNE(2,1))
end
Error: In an assignment A(I) = B, the number of elements in B and I must be the same.
0 个评论
采纳的回答
Star Strider
2014-12-19
See if this solves it:
for i_testen=1:5
...
Enkel_hoek_afg(i_testen,:) = Enkel_hoek(1:Afg_c_RANK_RKNE(2,1))
end
This assumes ‘Enkel_hoek(1:Afg_c_RANK_RKNE(2,1))’ is a row vector of constant length.
If it is not, create a cell array instead:
Enkel_hoek_afg{i_testen} = Enkel_hoek(1:Afg_c_RANK_RKNE(2,1))
Note that here, curly brackets ‘{}’ replace parentheses ‘()’ on the left-hand side of this assignment.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!