Using a variable value as linear array index

조회 수: 8 (최근 30일)
Ross Laws
Ross Laws 2017년 2월 7일
댓글: Ross Laws 2017년 2월 7일
Can you use a variable as an array index? for example: C = 200 - 30
then use C as the linear index for the array.
B(C)
This just multiplies B by C. Can you tell the program to just use the value of C?

채택된 답변

Adam
Adam 2017년 2월 7일
편집: Adam 2017년 2월 7일
Yes
B(C)
will use C to index into B, it doesn't multiply at all.
Surely you could just try this out on the command line, it is how I learned a lot of what I know!
  댓글 수: 1
Ross Laws
Ross Laws 2017년 2월 7일
I just realised this. Im and idiot, thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by