ocean800
ocean800

Reputation: 3727

Matlab matrix Row Manipulation?

If I have a matrix:

A = [ 1 2 
      3 4 
      5 6] 

how do I create another matrix from that so that it is:

B = [ 3 4 
      5 6] 

Basically, I just want to take the first row off of a matrix and assign the remaining to a new matrix. I tried:

B = A ([2,:],:)

but that didn't work... Any help would be greatly appreciated, thanks!

Upvotes: 0

Views: 99

Answers (1)

Benoit_11
Benoit_11

Reputation: 13945

You're close!

You can do like so:

B = A(2:end,:)

where you can use end to indicate the last column index of the array.

Upvotes: 2

Related Questions