Loading data with -9999 as NaN

Hi all,

I am loading csv data files into a matrix. The csv files use the value -9999 as NaN or Error code. Is there a LoadWave flag that would instruct Igor to read -9999 as NaN? Igor currently loads it as number and this makes graphing right away impractical.
If there is no switch for LoadWave is the alternative to go through the wave once it is loaded and replace -9999 with NaNs using conditional operators?

Thanks
Load the data normally into some wave say, wave1. Make sure that it is SP or DP. After loading execute the following commands:
Redimension/S wave1  // for SP
MatrixOP/O wave1=Replace(wave1,-9999,NaN)


I hope this helps,

A.G.
WaveMetrics, Inc.
I believe the 9999 business is a Fortran convention.

If your file is Fortran format (each column of numbers in a fixed field of characters), you can load it as "Fixed Field" which does have the option of treating 9999 as NaN. This is the last parameter of the LoadWave /F field. For details execute:
DisplayHelpTopic "Loading Fixed Field Text Files"


I'm not sure if it works with -9999.

Another approach is to convert -9999 to NaN after loading the data. Here is an example:
Make/O test = {1, 2, 3, -9999, 5, 6}
Edit test
test = test==-9999 ? NaN : test    // You need the space around the colon


For documentation on the ?: operator execute:
DisplayHelpTopic "? :"   // Note there is a space between ? and :



Thank you both for the quick reply.
hrodstein the 9999 is indeed from a Fortran piece of software however the data is further formatted into CSV with varying column lengths (due to column labels) after the initial computation in Fortran therefore I cannot use the fixed file format loading.
I think I will go with A.G. suggestion to use the Replace operation on the matrix.

Thanks again and enjoy your weekends.