Extract Time from file to make "time duration" wave

I currently have a macro that extracts time from my data files.

My problem is

1) that the" timewave" stops adding points after 127 data points.
why does the macro stop adding data points to the timewave after 127
2) it will not output the proper time duration over more than one day
is there a way to edit the current macro with a predefined function to fix this
3) Sometimes it will not add the correct point to the way ie..it will read files 150-170 before 1-149
why does it arbitrarily pick certain files?

overall I am trying to create a function or macro---not sure which one I would need, to extract times from sequential data files and use those extracted times to create a "timewave" that I can plot as a function of the other data that exists in the file. I posted earlier http://www.igorexchange.com/node/2806 and was not able to get the suggested function to work.

Does anyone have any suggestions?

Thanks.

Attached are 1 example of a data file, a zip folder with 150 sequential data files and the macro i am working with.



120111-50C_3_TS_1.txt time_duration_ macro.pxp test_0.zip
The reason that your "timewave" stops after 127 is because you only made a wave with 128 data points.

Make/O timewave

128 datapoints is the default size of a wave (points 0-127). you need to actually make a wave that is the correct size. Otherwise, your code keeps overwritting the last datapoint. I suggest that you use

Make/O/N=(itemsinlist(allnames)) timewave
This will ensure that "timewave" is the exact size you need.

As far as your third point, indexedfile will create a list of names based on their order within the folder. Check to make sure they are in the correct order (open the folder). I'm guessing that some of your files have an extra space in them, or something similar, which causes them to be placed in a different order within the folder.

The order of file names returned by IndexedFile is not guaranteed.

I believe that Mac OS returns file names in alphabetical order and Windows returns it in the order in which it was placed in the folder.

You might want to load all of the time stamps and then sort the resulting wave.

If your timewave is really a date/time wave then you need to make it double-precision using Make/D. Dates require double-precision.

With very few exceptions, new programming should use user-defined functions, not macros which are antiquated. For help in converting macros to functions, execute:
DisplayHelpTopic "Converting Macros To Functions"


But before you do a conversion, make sure to read the basic documentation on Igor programming - chapters IV-1 through IV-3 of the Igor manual.
How do I "You might want to load all of the time stamps and then sort the resulting wave." and where would I insert this function inside of the current macro?
also, can you sort existing waves in a table by the timestamp?
hrodstein wrote:
Use the Sort operation after all data has been loaded.

in the manual there is no sort by date/timestamp option for the sort operations...only sort by aphanumeric, case, or numeric
Quote:
in the manual there is no sort by date/timestamp option for the sort operations...only sort by aphanumeric, case, or numeric


I'm assuming that you are storing your date/time values in Igor date/time format. This is numeric - the number of seconds since January 1, 1904.

For details, execute:
DisplayHelpTopic "Date/Time Waves"