Please I want a help from you .
I have 3 vectors with values x=[2,4] y=[5,6] z=[2,1]
I want to say that [u,v,c]=[x,y,z]
and I want to use (obligatory) this formula :
[u,v,c]=???
I can say for example : a=[x,y,z]
but this is not allowed for our assignment .
I tried many time but Matlab said (too many arguments).
please help me.
Asked
Active
Viewed 79 times
-1

Tobias
- 4,034
- 1
- 28
- 35

Ibrahim Ghalawinji
- 13
- 1
- 2
-
1what is `[u,v,w]` - does this mean that `u=x`,`v=y`, or that each of `u`,`v`,`w` should become `[x,y,z]`? – Jonas Nov 15 '12 at 21:13
-
You can use `[u,v,d] = deal(a,b,c);`. – H.Muster Nov 15 '12 at 21:15
-
1Possible duplicate ["How do I do multiple assignment in MATLAB?"](http://stackoverflow.com/questions/2337126/how-do-i-do-multiple-assignment-in-matlab). – Tobias Nov 15 '12 at 21:28
-
1@Tobold That question deals with scalars. The answer doesn't work for vectors. – Tim Nov 15 '12 at 21:39
-
Thanks ,every thing is good now – Ibrahim Ghalawinji Nov 16 '12 at 02:27
-
@TimN Yes, you're right. Similar but not exactly the same. Who downvoted this? Maybe the questions' titles should be edited to reflect their focus on scalars and vectors respectively. "how to write in the left side [u,v,c]?" isn't compelling anyway. – Tobias Nov 16 '12 at 08:04
1 Answers
3
Use deal
, which matches up input and output lists:
>> [u,v,c] = deal(x,y,z)
u =
2 4
v =
5 6
c =
2 1

Tim
- 13,904
- 10
- 69
- 101