How to save in n different variables a vector data separated by comma
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Star Strider
2019-4-9
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!