How can i extract different rows of a matrix whose first column is same.. ?

1 22 36 1 22 38 1 23 30 1 23 27 1 23 41 2 0 4 2 19 49 2 19 46 3 1 6 3 1 6 3 10 14 3 21 34 3 22 47 3 23 53 4 0 24 4 9 8 4 9 41 4 11 27 4 11 38 4 13 9 I want to separate rows having same element in first column. i tried something like this
for i=1:10 if test(i,1)== 1 day1=test
end
end
can anyone show me how to extract the rows whose first column entry is same ??

Answers (1)

day1=test(test(:,1)==1,:);
Look up "logical addressing" in the documentation; it's a fundamental concept in Matlab

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 15 May 2014

Answered:

dpb
on 15 May 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!