Assign 1:x unique variables a name

2 visualizaciones (últimos 30 días)
Joshua Welsh
Joshua Welsh el 9 de Sept. de 2016
Respondida: Star Strider el 9 de Sept. de 2016
I would like to associate a number of unique numbers in a small array (<10) to a definition/name. The number of unique variables will vary from 2 to 5. I would like to be able to assign each unique variable that appears to a name so I can use their values in further expressions. How could I go about implementing this?
Thanks in advance for any help.

Respuestas (1)

Star Strider
Star Strider el 9 de Sept. de 2016
Just. Don’t.
Create an array, and refer to them as elements of the array instead. That is as unique as they need to be.
Example:
A = [1 3 7 2 5];
B = A(2) + A(5);

Community Treasure Hunt

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

Start Hunting!

Translated by