Code covered by the BSD License  

Highlights from
gap size

4.0

4.0 | 1 rating Rate this file 4 Downloads (last 30 days) File Size: 1.22 KB File ID: #31982

gap size

by Aslak Grinsted

 

28 Jun 2011 (Updated 01 Jul 2011)

Calculates number of consequtive NaNs in a vector.

| Watch this File

File Information
Description

USAGE: sz=gapsize(x)

EXAMPLE:
  x=rand(20,1);
  x(x>.5)=nan;
  [x gapsize(x)]

--------------
ans =
          NaN 2
          NaN 2
      0.33311 0
      0.28511 0
      0.38263 0
      0.20227 0
      0.37058 0
      0.43658 0
          NaN 1
    0.0049841 0
          NaN 1
     0.015303 0
          NaN 1
      0.26592 0
          NaN 4
          NaN 4
          NaN 4
          NaN 4
      0.20113 0
          NaN 1

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
29 Jun 2011 Chris

I'd recommended you adding support for row vectors - currently only column vectors are supported.

05 Aug 2011 Aslak Grinsted

Thanks for the suggestion, -it has been added.

Please login to add a comment or rating.
Updates
01 Jul 2011

FIX: Allow row-vectors.

Tag Activity for this File
Tag Applied By Date/Time
gap Aslak Grinsted 28 Jun 2011 09:43:57
nan Aslak Grinsted 28 Jun 2011 09:43:57
length Aslak Grinsted 28 Jun 2011 09:43:57
missing data Aslak Grinsted 28 Jun 2011 09:43:57

Contact us at files@mathworks.com