Simple matlab question (matrix->vector)

Status
Not open for further replies.

Thommer

Junior Member level 1
Joined
Apr 12, 2005
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,437
Hello All!

I have a probably primitive problem, but please help me!

I have a matrix (arbitrary), I want each row of this matrix to be in a separate vector.
eg:

y=[ -1 1 -1 -1
1 -1 1 -1
-1 1 1 -1];

I tried the following:

t = reshape(y',1,[]) ->

[-1 1 -1 -1 1 -1 1 -1 -1 1 1
-1]

then I'm looking for a command that splits this vector into
3 four-long subvectors..

Or is the any other idea how to solve the main problem?

Thank you,
Thommer
 

Hi Thommer,

One way is like this

row1 = y(1,; % first row
row2 = y(2,; % second row
... etc...

Regards

Z
 

hi
you can reffer to the help bit
addressing single row i
n matlab 7 help
i think it 'll help u for ur problem
bye
PD
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…