why can't find find my numbers

Discussion in 'MATLAB' started by r pearson, Jan 31, 2005.

  1. r pearson

    r pearson Guest

    I am trying to subset some data by time period. After loading the
    data into matlab, i check the first column(time-serial date) for a
    match against an element in a vector of times(serial date).

    find(data:),1) == timevec(3));

    This returns an empty matrix. The i checked the data in in the
    workspace and I can see the number(s) in the array editor. They
    match exactly to the values in timevec.
    Matlab does find the first of three times but not the last two.
    None of these work
    intersect(dataarray:),1), timevec);
    newtime=dataarray:),1) == timevec(2 or 3));

    What could be the problem?
    I did try with some random times earlier than the ones that I need
    and all the above worked.
    r pearson, Jan 31, 2005
    1. Advertisements

  2. Post a small subset of your data, showing something you think should
    work that doesn't. I'm sure we can help...
    Brett Shoelson, Feb 1, 2005
    1. Advertisements

  3. r pearson

    Steven Lord Guest

    They may look the same but the last bit or two may be different. For the
    section of your data that appears to contain the exact value of timevec(3),
    compute "data(thatblock)-timevec(3)". You should see some the results that
    are very close to, but not exactly equal to, zero. [You may need to use
    FORMAT LONG G to see the results to more than just 4 decimal places.]

    Look at:


    and question 5.1 in the newsgroup FAQ:

    Steven Lord, Feb 1, 2005
  4. r pearson

    r pearson Guest

    I found the problem with find. The numbers differed by 1x10-9 *
    I talked to the people that create the files and told them they need
    to modifiy the output to prevent this. We found we could not keep
    the time in matlab serial format because the errors keep occuring.
    We decided on an integer yyyymmddHHSS since the new version of
    datanum lets us convert it back easily.
    Everyone using the data did not have the mapping toolbox installed so
    roundn, which worked, could not be coded into the program.
    Thanks so much to everyone for their input.
    Viva the newsgroup.
    r pearson
    r pearson, Feb 1, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.