simple coding with if-else statement

I have a dataset with a date/time variable, and I need to create a new categorical variable based on these times (i.e. night, day). What is the best way to do this? Sorry for the total noob question.

Thanks,

J
Since date/time info in Igor is stored as seconds since 1/1/1904, you can do arithmetic with waves. For instance:
make junk=x    // by default, as 128-point wave
SetScale/P x 3450384000,14400,"dat", junk   // covers a stretch of time
junk = mod(x, 86400)>43200
Display junk

The above fills the wave "junk" with a square wave with transitions at midnight and noon (one day = 86400 seconds). I have attached a picture of the graph.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks John. I'd like to develop a function that can output times of the day across multiple days, each of which have different sunrise/set times. I've been thinking of using something like this if statement, where timeofday is a new wave, dawn and dusk are predefined times:
Obviously I'm inexperienced with Igor programming, and while the manual gives good examples of how to use if statements with simple variables defined as a few numbers, I can't get this to work on waves.
Thanks a million for your help

J
First, it's better to paste the actual text into your posting so that it can be copied/pasted/edited, etc. Code tends to play badly with HTML, so it is best to enclose it in the appropriate tags: http://www.igorexchange.com/node/3221

I think part of your problem is that you are dividing date by time. What is date? What is time? Perhaps you have one wave containing date (probably coded in Igor's internal seconds-since-1904 coding) and another containing time of day (hopefully in seconds since midnight). If that is true, then a likely first step would be to combine them by adding:
Duplicate date, datetime
datetime = date+time

Next, Igor uses regular quote marks to enclose strings, not single quotes. And unfortunately the conditional operator doesn't work with strings.

Perhaps the final expression would be something like
timeofday = SelectString(datetime > dawn && datetime < dusk, "night", "day")
This will work if dawn and dusk are also in Igor's date-time format.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com