Tuesday, May 26, 2009

Matlab: generate unique ID number

To generate a unique ID number for e.g. a temporary file or seed for random number generator current date/time in milliseconds can be used. I matlab the only command that gives time in milliseconds is datestr with FFF input e.g. datestr(now,'MMSSFFF')

ans =

5139451
datestr(now,'MMSSFFF')

ans =

5140057

UID=datestr(now,'MMSSFFF')

UID =

5214981

Unfortunatly other commands such as cputime or now don't return time in milliseconds, which is not so good.

3 comments:

  1. Anonymous1:56 PM

    Howdy!
    Someone in my Facebook group shared this website with us so I came
    to give it a look. I'm definitely enjoying the
    information. I'm bookmarking and will be tweeting this to
    my followers!
    Terrific blog and
    brilliant design.

    Look into my web-site: Please visit my site

    ReplyDelete
  2. Anonymous12:01 PM

    I know this if off topic but I'm looking into starting my own blog and was wondering what all is required to get set up? I'm assuming having a blog like yours would cost a pretty penny?
    I'm not very
    web savvy so I'm not 100% sure. Any
    recommendations or advice would be greatly appreciated. Thank you

    Feel free to visit my blog post :: Please visit my site

    ReplyDelete
  3. Quite right! It is good idea. It is ready to support you. fake passport

    ReplyDelete