Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8912397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:11:17+00:00 2026-06-15T04:11:17+00:00

I have a time series in the following format: time data value 733408.33 x1

  • 0

I have a time series in the following format:

time       data value
733408.33  x1
733409.21  x2
733409.56  x3
etc..

The data runs from approximately 01-Jan-2008 to 31-Dec-2010.
I want to separate the data into columns of monthly length.

For example the first column (January 2008) will comprise of the corresponding data values:

(first 01-Jan-2008 data value):(data value immediately preceding the first 01-Feb-2008 value)

Then the second column (February 2008):

(first 01-Feb-2008 data value):(data value immediately preceding the first 01-Mar-2008 value)

et cetera…

Some ideas I’ve been thinking of but don’t know how to put together:

  1. Convert all serial time numbers (e.g. 733408.33) to character strings with datestr
  2. Use strmatch('01-January-2008',DatesInChars) to find the indices of the rows corresponding to 01-January-2008
  3. Tricky part (?): TransformedData(:,i) = OriginalData(start:end) ? end = strmatch(1) - 1 and start = 1. Then change start at the end of the loop to strmatch(1) and then run step 2 again to find the next “starting index” and change end to the “new” strmatch(1)-1 ?

Having it speed optimized would be nice; I am going to apply it on data sampled ~2 million times.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:11:18+00:00Added an answer on June 15, 2026 at 4:11 am

    I would use histc with a list a list of last days of the month as the second parameter (Note: use histc with the two return functions).
    The edge list can easily be created with datenum or datevec.

    This way you don’t have operation on string and you that should be fast.

    EDIT:
    Example with result in a simple data structure (including some code from @Rody):

    % Generate some test times/data
    
    tstart = datenum('01-Jan-2008');
    tend   = datenum('31-Dec-2010');
    
    tspan = tstart : tend;
    tspan = tspan(:) + randn(size(tspan(:))); % add some noise so it's non-uniform
    
    data = randn(size(tspan));
    
    % Generate list of edge
    edge = [];
    for y = 2008:2010
        for m = 1:12
            edge = [edge datenum(y, m, 1)];
        end
    end
    
    % Histogram
    [number, bin] = histc(tspan, edge);
    
    % Setup of result
    result = {};
    
    for n = 1:length(edge)
        result{n}  = [tspan(bin == n), data(bin == n)];    
    end
    
    % Test
    % 04-Aug-2008 17:25:20
    datestr(result{8}(4,1))
    tspan(data ==  result{8}(4,2))
    datestr(tspan(data ==  result{8}(4,2)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an irregular(?) time series data points in a day as following Jun
I have imported a time series with dates of the following format: test =
I have a data frame with a series of times in the following format:
I am using barchart from the lattice package. I have time series data going
I have an xts time series of weekly values Jan 4 2004, 0.99 Jan
I have a data.frame of a time series of data, I would like to
I have the following code to create a random series of a numbers from
I have a table of time-series data of which I need to find all
I have the following time series > y<- xts(1:10, Sys.Date()+1:10) > y[c(1,2,5,9,10)] <- NA
I have a .dat file of time series data for options so it includes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.