Answer to Question #124468 in MatLAB for Pratima

Question #124468
how do i use : to assign the second column of the matrix M to a vector fmodel and the third column to a vector fexperiment. Can you show me an example please
1
Expert's answer
2020-06-29T08:14:36-0400
# defining a matrix in matlab
a = [1 2 3;4 5 6;7 8 9]
# taking 2 cloumn 
a2 = a(:,2)
# changing 2 column to vector fmodel
fmodel = reshape(a2,1,[])

# taking 3 cloumn 
a3 = a(:,3)
# changing 3 column to vector fexperiment
fexperiment = reshape(a3,1,[])
 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Pratima Rai
30.06.20, 02:31

Thank you!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS