BigChief
BigChief

Reputation: 1515

Matlab basic matrix transformation to vector

I have a matrix like this: data(:,61:90) I would like to make a vector from this where columns 61...90 are appended vertically. What is the best way to do this?

Upvotes: 1

Views: 115

Answers (1)

Nematollah Zarmehi
Nematollah Zarmehi

Reputation: 694

Use reshape() to reshape array and vec2mat() to convert vector to matrix. Try this code for your problem.

my_vect = data(:,61:90);
my_vect = reshape(my_vect,[],1);

or simply:

my_vect = my_vect(:);

Upvotes: 1

Related Questions