user3466022
user3466022

Reputation: 145

Matlab: extract only odd columns from matrix

I have a matrix NxN.

I want to extract values only from odd columns in this matrix.

http://photoload.ru/data/38/5d/d2/385dd20f148fd21a08de36a9c03e69a1.jpg

And after generate new matrix by this values.

How, I can do it?

Upvotes: 2

Views: 3228

Answers (1)

physics90
physics90

Reputation: 961

% data is NxN matrix

newData = data(:, 1:2:end);

%The 1:2:end says start with first column, skip every other until end

Upvotes: 5

Related Questions