Be the first to rate this file! 132 downloads (last 30 days) File Size: 2.28 KB File ID: #21891

Time index

by Robert Bemis

 

26 Oct 2008

Code covered by BSD License  

TIMEIDX returns numeric index given time string

Download Now | Watch this File

File Information
Description

>> help timeidx
 TIMEIDX returns numeric index given time string.
    D = TIMEIDX(T) returns index value in relative days which is suitable for
        DATENUM math. To work in hours multiply by 24, for seconds multiply
        by 24*3600, etc. T can be a time string (DD:HH:MM:SS) where DD, HH
        and MM are incrementally optional and SS can include a decimal
        fraction. For multiple time values T must be a cell array of strings.
        The result is the same size/shape but type DOUBLE.
 
    D = TIMEIDX(T1,T2) returns a range of values. T1 and T2 are individual
        time strings (as above) and the result is a 1x2 DOUBLE array.
 
    N = TIMEIDX(...,FS) instead returns index values in sample units relative
        to the beginning of a record where FS is samples/second. Sample
        values are rounded to integer values. Time 0 corresponds to sample 1.
 
 Example 1: operation times out after 5 minutes
    t2 = now+timeidx('5:00')*24*3600;
    while ~done && now<t2
      %wait for something else to happen
    end
    if ~done
      error('Operation failed to complete in 5 minutes')
    end
 
 Example 2: specify portion of WAV file to read
    range = timeidx('2.5','1:02.5',Fs); %1 minute after 2.5 second delay
    x = wavread('myfile.wav',range);
 
 See also DATENUM, DATESTR

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
audio processing Robert Bemis 27 Oct 2008 10:32:51
data export Robert Bemis 27 Oct 2008 10:32:51
data import Robert Bemis 27 Oct 2008 10:32:51
signal processing Robert Bemis 27 Oct 2008 10:32:51
utility Robert Bemis 27 Oct 2008 10:32:51
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com