Loading Delimited Text Help

Hello. Im an Igor Beginner and I've made a Macro to load delimited text and tell it to graph each columns. I also make a forward and a backward button so that i can scroll through the graph. But It give me error after i went through all my columns.
So here is my question, how can i tell my macro to stop and do nothing when column have no value? Or is there a way for me to tell the macro to find how many columns i have that contains numeric values and stop counting columns when it's blank?
Thank you very much.

Here is my procedure and the text i used.
test1_0.txt (176.17 KB) open high speed Part 3_0.ipf (1.88 KB)
thang wrote:
Hello. Im an Igor Beginner and I've made a Macro to load delimited text a...


Your open1(...) and open2(...) functions might include an appropriate test of the values in either junk or tempwave.

if (tempwave[0]=NaN)
   ... (no data in this column, so do whatever is needed)
endif


FWIW, the SpXZeigR routines found here already include a delimited text file loader and display control panel that you might find useful. The FTIR file loaders include a module that I believe works with the OOBase files (rather than the straight tab-delimited text files).

Also, the routines in LinkDisplay were designed for waves such as that loaded from an OceanOptics spectrometers where the first column is a "x-axis" that is to be linked to all other columns.

Finally, I've had to work extensively to load and display OceanOptics files before and would be glad to help off-line from this forum with your developments.

Let me know.

HTH

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
jjweimer wrote:

if (tempwave[0]=NaN)
   ... (no data in this column, so do whatever is needed)
endif



To test for equality you need to use ==, not =.

However, == does not work with NaN. You must use NumType:

if (NumType(val) == 2)
  Print "NaN!"
endif


As for the original question, I don't see where in your code you are trying to scroll through the graph.

To get information about traces in the graph use TraceNameList, TraceNameToWaveRef and WaveRefIndexed.

Also, you should not write macros but rather user-defined functions. For details, execute this:

DisplayHelpTopic "Programming Overview"



thang wrote:
Here is my procedure ...


Put this code in the open1 function just after loadwave

if (exists("junk0")==0)
    return 0
endif


Put this code in the open2 function just before loadwave

if (framenumber<=2)
    return 0
endif


That should stop the error messages.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH