Using a variable value as linear array index

7 vues (au cours des 30 derniers jours)
Ross Laws
Ross Laws le 7 Fév 2017
Commenté : Ross Laws le 7 Fév 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?

Réponse acceptée

Adam
Adam le 7 Fév 2017
Modifié(e) : Adam le 7 Fév 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!
  1 commentaire
Ross Laws
Ross Laws le 7 Fév 2017
I just realised this. Im and idiot, thanks.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by