If the data is in a text wave you'll have to use parse the date into months, year and day, then use date2secs. Do the same for the time and add together.
(Make your time waves unsigned 32 bit integer waves).
However, you may be lucky and the load may have realised that it was loading time/date info and those waves may be numeric. If so, then you should be able to add the two waves together.
Ok, well IGOR didn't do the work for me... so here's my file:
[wave0 = mm/dd/yyyy] and [wave1 = hh:mm:ss]
Now I know that both waves can be reformatted to integer data types and I'd eventually like to perform the operation:
Make newWave
newWave = wave0 + wave1
...this works fine when I perform the operation by hand, but I'd like to get it working via the procedure
I've got:
--------------------------------------------------------------------------------------
#pragma rtGlobals=1
Menu "someFolder"
"someFile", someProcedure()
End
Function TableAndGraph()
variable tFile, i
String xName, yName
Prompt tFile, "What files do you have?", popup "fileOne; fileTwo; Both"
DoPrompt "Please enter the files", tFile
if (tFile == 1)
LoadWave/J/A/K=0/V={"\t","",0,0}
Duplicate wave0, newWave;
Edit wave0,wave1,newWave;
newWave = wave0 + wave1; <-- here's where IGOR is getting hung up
Rename newWave, 'Time Stamp'
----------------------------------------------------------------------------------------
Any and all thoughts would be greatly appreciated.
You need to declare the waves after they are created by LoadWave:
LoadWave . . . // Creates wave0 and wave1 Wave wave0, wave1 // Let Igor know that wave0 and wave1 are the names of waves in the current data folder.
You don't need to declare newWave because Igor automatically declares waves created by Make or Duplicate if they are specified by simple names (Make newWave) rather than paths (Make root:newWave) or through strings (Make $stringContainingWaveName).
For details, execute this:
DisplayHelpTopic"Accessing Global Variables And Waves"
Ok I think I've figured out where the problem lies.
Naturally, the columns are being read as 'general' (or strings)... which is fine.
I'd like to do one of the following:
1) Simply concatenate strings -->
- 'newWave' = 'wave0' + ' ' + 'wave1' <-- or something like that
2a) Reformat the columns as double precision decimals (with respect to that absolute 0 time... the year 1902 or something?)
b) Add the doubles together
c) Reformat the cell as 'date and time'
... I tried doing both manually (with my mouse rather than through the procedure) and couldn't do either. Any suggestions?
Naturally, the columns are being read as 'general' (or strings)... which is fine.
Ideally date and time columns should be read as numeric and should create numeric waves. This is what would have happened if Igor recognized the date/time format in your data file.
Apparently this is not the case so you must tell Igor what the date format is. Choose Data->Load Waves->Load Waves, selected Delimited Text, click the Tweaks button, click the Date Format button, and tell Igor how your dates are formatted. Then the date column should be loaded into a double-precision numeric wave.
It that does not get you going, please zip your data file and your procedure or experiment file and send to support@wavemetrics.com along with a description of what you want. Also specify your OS and Igor version.
(Make your time waves unsigned 32 bit integer waves).
However, you may be lucky and the load may have realised that it was loading time/date info and those waves may be numeric. If so, then you should be able to add the two waves together.
December 22, 2010 at 12:49 pm - Permalink
[wave0 = mm/dd/yyyy] and [wave1 = hh:mm:ss]
Now I know that both waves can be reformatted to integer data types and I'd eventually like to perform the operation:
Make newWave
newWave = wave0 + wave1
...this works fine when I perform the operation by hand, but I'd like to get it working via the procedure
I've got:
--------------------------------------------------------------------------------------
#pragma rtGlobals=1
Menu "someFolder"
"someFile", someProcedure()
End
Function TableAndGraph()
variable tFile, i
String xName, yName
Prompt tFile, "What files do you have?", popup "fileOne; fileTwo; Both"
DoPrompt "Please enter the files", tFile
if (tFile == 1)
LoadWave/J/A/K=0/V={"\t","",0,0}
Duplicate wave0, newWave;
Edit wave0,wave1,newWave;
newWave = wave0 + wave1; <-- here's where IGOR is getting hung up
Rename newWave, 'Time Stamp'
----------------------------------------------------------------------------------------
Any and all thoughts would be greatly appreciated.
December 23, 2010 at 02:29 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
December 23, 2010 at 04:05 pm - Permalink
December 24, 2010 at 08:17 am - Permalink
Wave wave0, wave1 // Let Igor know that wave0 and wave1 are the names of waves in the current data folder.
You don't need to declare newWave because Igor automatically declares waves created by Make or Duplicate if they are specified by simple names (Make newWave) rather than paths (Make root:newWave) or through strings (Make $stringContainingWaveName).
For details, execute this:
December 24, 2010 at 10:51 am - Permalink
Naturally, the columns are being read as 'general' (or strings)... which is fine.
I'd like to do one of the following:
1) Simply concatenate strings -->
- 'newWave' = 'wave0' + ' ' + 'wave1' <-- or something like that
2a) Reformat the columns as double precision decimals (with respect to that absolute 0 time... the year 1902 or something?)
b) Add the doubles together
c) Reformat the cell as 'date and time'
... I tried doing both manually (with my mouse rather than through the procedure) and couldn't do either. Any suggestions?
December 24, 2010 at 01:34 pm - Permalink
Ideally date and time columns should be read as numeric and should create numeric waves. This is what would have happened if Igor recognized the date/time format in your data file.
Apparently this is not the case so you must tell Igor what the date format is. Choose Data->Load Waves->Load Waves, selected Delimited Text, click the Tweaks button, click the Date Format button, and tell Igor how your dates are formatted. Then the date column should be loaded into a double-precision numeric wave.
It that does not get you going, please zip your data file and your procedure or experiment file and send to support@wavemetrics.com along with a description of what you want. Also specify your OS and Igor version.
December 24, 2010 at 01:40 pm - Permalink
The major problem was loading the date from line 0 of the files which contained column labels instead of from line 1 where the data actually started.
December 24, 2010 at 07:45 pm - Permalink