Timewave to seconds

Hi All,

I think this should be an easy solution but I havn't quite figured it out.

I have a wave where each point is formatted to hour:minute: seconds (i think this is compatible with excel)
I'd like to make a new wave only in seconds.

There must be a simple solution to this.

Thanks,
N
Quote:
I have a wave where each point is formatted to hour:minute: seconds (i think this is compatible with excel)
I'd like to make a new wave only in seconds.


This is ambiguous.

You may have a text wave where each element is formatted as hh:mm:ss.

Or you may have an Igor date/time wave. In an Igor date/time wave, the values are stored as seconds since 1904-01-01. If you have no date part then the values are times in seconds so no conversion is necessary.

These commands illustrate these points:
Make/O/D/N=2 test1
SetScale d 0, 0, "dat", test1   // Mark as date/time wave
test1[0] = 12*3600 + 30*60 + 15     // 12:30:15
Edit test1
Make/O/D/N=2/T test2 = {"12:30:15", ""}
Append test2
Print test1[0]      // Prints value in seconds
Print test2[0]      // Prints string


If your wave is a text wave then to convert to seconds you need to parse the text. This may help: http://www.igorexchange.com/node/613
Hi Hrodstein,

Thanks for that. I couldn't quite make your snippet work. Is there a typo? I don't think my initial wave was a text wave, it was in the date/time format.
Anyway i think i might have solved the issue.

I changed the wave scaling of the wave to numeric and it seemed to work well and I can now do reasonable curve fittings which is great.

Thanks for your help, sorry for the late reply.

Best wishes,
N

Quote:
Is there a typo?


Yes. "test[0]" should have been "test1[0]". I have fixed it.