Looking for advice on "expected wave name"

Hello,

I am getting sporadic errors saying: "While executing histogram, the following error occurred: expected wave name."
I get the error when Igor (Igor 64-bit 6.3.2.3 (Build 17966)) runs fully automated in the background. When I run it manually, things work fine. For example, when I set a breakpoint on every histogram and look at the parameters before it runs, things are OK. If I were confusing multiple versions of my ipf file, that would be a good explanation, but I only have one of them.

There are many places where my code looks like this:
    WAVE LC;
    binWidth=1;
    binNum=80;
    Make/N=(binNum)/O LC_Hist;
    Histogram/C/P/B={0,binWidth,binNum} LC,LC_Hist;
    Display LC_Hist as "LC";


In this case, the wave LC was created in a separate function, so I have the WAVE statement here. It definitely exists, as does LC_Hist.

This looks kind of like a timing issue. Do I need to do anything to make sure that Make completes before I call Histogram?
ThomasSLigon wrote:
This looks kind of like a timing issue. Do I need to do anything to make sure that Make completes before I call Histogram?

No, Igor's code works strictly in serial fashion. It is far more likely that the wave reference LC is NULL. Before running the code, right-click in any procedure window and select Enable Debugger. Right-click again and select NVAR, SVAR, Wave Checking. Right-click once more and select Debug on Error.

Now Igor's debugger will pop up when the error happens, and you can investigate what's happening. I would bet that the debugger will pop up after the WAVE statement and that LC is NULL. But you never know...

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Hello John,

thanks! Your suggestions are very helpful.

Unfortunately, I'm still struggling. Now, I think I have a problem with reading a text file using a symbolic path name. When I set a breakpoint and hover the mouse over the name of the symbolic path, it always shows a question mark.
Could it be that the debugger doesn't know how to display a symbolic path name?

I am working on this piece of code:
    fileName = "tonsetmRNA.txt";
    NewPath/O pathNameS, pathName;  
    PathInfo/SHOW pathNameS;
    print "pathName:"+pathName+"\n";
    print "S_path: "+S_path+"\n";
    WAVE tonsetmRNA
    WAVE t0
    LoadWave/J/O/W/A/D/P=pathNameS fileName;
    binWidth=.5;
    binNum=20;
    Make/N=(binNum)/O tonsetmRNA_Hist;
    Histogram/C/P/B={0,binWidth,binNum} tonsetmRNA,tonsetmRNA_Hist;


I now have pathName with an SVAR in every function, and I'm running NewPath in every function, where I originally assumed that the result of NewPath would be global and persistent.
Here is the console log after running that piece of code:
  path: "C:data:Tom:Research:Raedler:mRNA-Leonhardt:TFC:"
  pathName:C:\data\Tom\Research\Raedler\mRNA-Leonhardt\TFC
  S_path: C:data:Tom:Research:Raedler:mRNA-Leonhardt:TFC:
  Delimited text load from "tonsetmRNA.txt"
  Data length: 281, waves: tonsetmRNA


This tells me that LoadWave succeeded in reading the wave tonsetmRNA from a text file, but hovering the mouse over the wave name shows a question mark, and the Histogram fails because of the missing wave name. However, when I just run this function a second time, it works correctly. So, it looks very much like I have failed to initialize something, but I haven't been able to figure that out.

Tom
Are you expecting the wave tonsetmRNA to be created by the LoadWave command? If so, the WAVE statement is in the wrong place. WAVE statements have dual function: at compile time, they tell Igor that a particular name (tonsetmRNA, for instance) refers to a wave. That allows the compiler code to compile wave-manipulating code rather than something else, like variable-manipulating code. At runtime, the WAVE statement causes Igor to go looking for a real wave with the specified name. If the wave doesn't exist at the point in the code where you put the WAVE statement, then the result is a NULL wave reference. So if the wave is created by LoadWave, you need to put the WAVE statement after the LoadWave command.

Symbolic paths are global objects. Once created, you can use them anywhere. And, yes, the debugger doesn't know how to display the contents of a symbolic path.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com