I am creating a vector but its throwing some error. Example I create vector a= [3.4 -4.90 0.23], and when I access it a[1] it gives error.
1 回表示 (過去 30 日間)
古いコメントを表示
array problem
採用された回答
Shivani Dixit
2021 年 6 月 7 日
In MATLAB, we access the elements of an array using paranthesis () and not square brackets [ ]. You can see an example below :
arr =[3.4 -4.90 0.23];
arr(1)=3.4 % using arr[1] would lead to error as in your case
arr(2)=-4.90
arr(3)=0.23
2 件のコメント
Shivani Dixit
2021 年 6 月 7 日
Yeah , great . We are allowed to put our independent views on the question.
その他の回答 (1 件)
KSSV
2021 年 6 月 7 日
You should not use square braces.. a[1] not allowed.
Use a(1)
a= [3.4 -4.90 0.23] ;
a(1)
a(end)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!