can matlab handle data with microsecond precision and use it to create graph?

Asked by Oleg on 21 Jul 2012
Latest activity Commented on by Walter Roberson on 21 Jul 2012

I'm using matlab to write graphic of stock price. On X I just use "number of microsecond elapsed from certain moment". So this is just integer value so matlab is easy to handle it. But it is not convenient because every time I have to "convert" "number of elapsed microseconds" to "time". I would prefer to see actual "time" instead.

Can matlab handle something like that "16:15:13:460882"? I need to create graph from the series of "time, value".

If so what format should I use? I need Matlab to understand that this is "time"

0 Comments

Oleg

Products

1 Answer

Answer by Walter Roberson on 21 Jul 2012
Accepted answer

Unfortunately, MATLAB's date processing routines only extend to milliseconds; see http://www.mathworks.com/help/techdoc/matlab_prog/bspgcx2-1.html#bspgc4m-1

It could -- there is enough precision available to handle milliseconds up to year numbers above 100,000 -- but it does not.

You can apply your own time labels to a graph by setting XTickLabel or YTickLabel cell arrays of strings.

2 Comments

Oleg on 21 Jul 2012

actually I just realized that "milliseconds precision" is exactly what I actually need. Will matlab automatically recognize columns as "date" if I'm using dlmread function to read context of the file to variable and then I use plot to create graph? Thanks.

Walter Roberson on 21 Jul 2012

No, dlmread() expects numeric data. textscan() would give more flexibility. There is no "date" format field, though, so you would need to read the field as a string and then datenum() the strings.

There is a possibility that importdata() might recognize the file.

Walter Roberson

Contact us