Using a variable value as linear array index

7 Ansichten (letzte 30 Tage)
Ross Laws
Ross Laws am 7 Feb. 2017
Kommentiert: Ross Laws am 7 Feb. 2017
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?

Akzeptierte Antwort

Adam
Adam am 7 Feb. 2017
Bearbeitet: Adam am 7 Feb. 2017
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!

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by