필터 지우기
필터 지우기

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
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

추가 답변 (1개)

KSSV
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)

카테고리

Help CenterFile Exchange에서 Desktop에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by