Possible Duplicate:
How do I do multiple assignment in MATLAB?
So let's say I have a vector p = [1 2 3]
. I want a command that looks like this:
[x y z] = p;
so that x = p(1), y = p(2), and z = p(3).
Is there an easy way to do this?
Convert to cell array.
pCell = num2cell(p);
[x,y,z] = pCell{:};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With