Question

Possible Duplicate:
Is it possible to show numbers in non-engineering format in Matlab?

am reading a set of unix timestamps from a file using dlmread

say 1311120481 1311120542 1311120603

in an array . After reading all values are coverted to exponential . 1.311e+9 etc ... But i need the actual timestamps to use it create a range around it.

Can anyone help how to get the values as it is ?

Thanks,

Was it helpful?

Solution

This is an effect of how Matlab displays numbers rather than how it stores them. It has not actually converted the values to a new format; it just chooses to display them this way. You can change how Matlab displays values using the format command:

>> x = [1311120481 1311120542 1311120603]

x =

   1.0e+09 *

    1.3111    1.3111    1.3111

>> format longg
>> x 

x =

                1311120481                1311120542                1311120603

Sometimes it is also useful to simply subtract some large, known offset:

>> x - x(1)

ans =

     0    61   122

You can also use fprintf:

>> fprintf('%d\n', x)
1311120481
1311120542
1311120603
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top