Why this gives error?
1 回表示 (過去 30 日間)
古いコメントを表示
LB=[0 0 0 0];
UB=[10 10 pi pi];
particles_x(1,1)=LB+rand*(UB-LB)
1 件のコメント
Jan
2022 年 4 月 15 日
I've added the error message. Please care for including the message in future questions about errors.
回答 (2 件)
Jan
2022 年 4 月 15 日
LB = [0 0 0 0];
UB = [10 10 pi pi];
size(LB + rand * (UB - LB))
You cannot assign a [1 x 4] vector to the scalar particles_x(1,1).
0 件のコメント
KuriGohan
2022 年 4 月 15 日
You get a 1x4 array on the right that you want to save inside the first row of the first column of the array - you cant do that. Just write particles_x=LB+rand*(UB-LB) and then particles_x(1,1) to acess what you want (at least what i think you want, that is the first element of that matrix).
5 件のコメント
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!