Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
i need some help
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i want to assign variable depend on anothor variable
3 commentaires
John D'Errico
le 17 Fév 2020
Learn to use MATLAB as a vector and array language. After all, that is how it is designed to be used.
Réponses (1)
Bob Thompson
le 17 Fév 2020
Modifié(e) : Bob Thompson
le 17 Fév 2020
If I'm understanding what you're trying to do, you're only missing parentheses.
>> n = 10;
>> p(10) = 2;
>> p(n)
p(n) =
2
You can also assign values in a similar manner.
>> n = 10;
>> p(n) = 2;
>> p(10)
p(10) =
2
2 commentaires
Bob Thompson
le 18 Fév 2020
Yes, because the value inside the parentheses is referencing a position within an array. You cannot call a 0 placement, because a 0 position doesn't make sense.
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!