Code covered by the BSD License  

Highlights from
GROUPFIND

3.66667

3.7 | 3 ratings Rate this file 3 Downloads (last 30 days) File Size: 1.92 KB File ID: #1498
image thumbnail

GROUPFIND

by Manu Raghavan

 

15 Mar 2002 (Updated 25 Mar 2002)

Find groups of data from a vector.

| Watch this File

File Information
Description

Extract groups of data from a vector. For example:

x=[0 1 2 2 1 0 -1 1 3 5 3];
groupfind(x>0)
ans =

     2 5
     8 11

In this case, the first group is from indices 2 to 5 and the second is from indices 8 to 11.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
13 Aug 2002 John McQueen

Your program is truly amazing! It is the ultimate solution to everything I was looking for. I was astonished at how easy it is to use! Not only do you provide specific knowledge, but you also provide the MOTIVATION that has driven me to such success. This opportunity has surely changed my life. If you are skeptical like how I was, you will see the light!

07 Jan 2008 Piyush Singh

Trivial bug in the code

>> x = [0 0 0 0 0 0 0]

x =

     0 0 0 0 0 0 0

>> groupfind(x>0)
??? Subscript indices must either be real positive integers or logicals.

Error in ==> groupfind at 47
ind(:,2)=temp([idx; end]); % create 2nd column first to allocate all memory

19 May 2008 Wladimir Alonso

This function was very useful when I needed to plot only certain "fragments" of a time-series using the "plot" function:

blocks_of_relevant_points = groupfind(boolean_relevant_points>0);
for i=1:size(blocks_of_relevant_points,1)
    i_relevant_points_this_block = blocks_of_relevant_points(i,1):blocks_of_relevant_points(i,2);
    hold on
    plot(time_points(i_relevant_points_this_block), time_series(i_relevant_points_this_block));
end

In this way I managed to get rid of the lines that were connecting each fragment.

many thanks Mickey!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
matrices Mickey Stahl 22 Oct 2008 06:43:04
find group Mickey Stahl 22 Oct 2008 06:43:04
search Mickey Stahl 22 Oct 2008 06:43:04
vector Mickey Stahl 22 Oct 2008 06:43:04
vectorize Mickey Stahl 22 Oct 2008 06:43:04

Contact us at files@mathworks.com