How to save in n different variables a vector data separated by comma

1 vue (au cours des 30 derniers jours)
Juan Jose Ortiz Torres
Juan Jose Ortiz Torres le 9 Avr 2019
Hi everybody.
I need help please. Anyone know how can I save a vector number composed by 2 columns and n rows in 2 different variables?. For example in the first iteration, the vector is like the following:
RX=[1.23,4.56]
I expect the algorithm divide the vector until the comma then create the variables A and B with the coefficients data:
A=1.23
B=4.56
Thanks

Réponses (1)

Star Strider
Star Strider le 9 Avr 2019
It will do that for cell arrays, although not numerical arrays:
RX=[1.23,4.56];
RXc = num2cell(RX);
[A,B] = RXc{:}
producing:
A =
1.23
B =
4.56
Note that this is relatively new, however I don’t remember the MATLAB version that introduced this. If you cannot reproduce the result I posted here with your version, you may need to use the deal (link) function.

Catégories

En savoir plus sur Logical 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