Array analysis problems

Hi All,

I already posted this note in another forum topic called For Loop Mistake. I thought it would also be better to just open it up to the general group. I have added a lot more detail to what Im trying to do. I have also attached my code along with a jpeg of the arrays that I am working with. I would be grateful for some help! I have attached picture, you can zoom in by clicking on the Original image option.

Basically,
-NumLevelCrossing indicates the number of times the particular y value is crosssed in the entire wave, described by the XValues, and YValues.

-You can ignore Column 5 All Crossings.

-Crossings0, Crossings1... Crossings 6 and so on and so forth, basically describe the locations of each crossing for each particular Yvalue. So Crossing0 describes, the '3' Crossings at Xvalue location in terms of their points: 0, 10, and 29.
(I used FindLevels to find these locations, if I want them in terms of the XValues (column 2) instead of points, should I add /P ? )

-My calculation involves two parts:

For each x-value seen in each Crossings0, Crossings1 ... Crossings 6 file, I have to calculate such that

(1) for all x' > x, find the y-values (from YValues) < 1, and note them down along with corresponding x-values (from XValues).
(x' is just a parameter to denote any other x value > the particular x value chosen,
so if i say x = 0, then all x values above it , in my particular sample will have to be considered)

(2) for all x' > x, find the yvalues > 9, along with their corresponding xvalues

The values 1 and 9 are just set constants, so I denoted them under variables crosssing0, and crossing1, in my code.

This is my full code so far. The commented section is something that I tried to see if it works:
 
Function SplittingProbabilityNumerator4(rawwave3, rawwave5, rawwave6)
      Wave rawwave3 //Xvalues
      Wave rawwave5 //Yvalues
      Wave rawwave6 //NumLevelCrossing
 
    Variable crossing0 = 1
    Variable crossing1 = 9
 
    Variable count0 = 0
 
    Variable i
    Variable j
    Variable k
 
 
    String List = WaveList("Crossings*", ";", "")
    for (i=0; i<ItemsinList(List); i+=1)
        String NextString = StringFromList(i, List)
        wave NextWave = $NextString //Creates a local reference to an existing wave
        print NameofWave(NextWave) //do something with NextWavve
 
        variable npNW, npRW3
        npNW = numpnts(NextWave)
        npRW3 = numpnts(rawwave3)
 
        Make /D/O Yvalueundercrossing, Xvalueundercrossing  
        for(k=0; k<npNW; k+=1)
                  for(j=0; j<npRW3; j+=1)
                    if((rawwave3[j] > nextwave[k]) && (rawwave5[j] < crossing0))
                             Yvalueundercrossing[count0] = rawwave5[j]
                            Xvalueundercrossing[count0] = rawwave3[j]
                             count0 += 1
                                Redimension /N=(count0) Yvalueundercrossing, Xvalueundercrossing
                   endif
                 endfor
            endfor
    endfor 
 
End
 
//Make /D/O Yvalueundercrossing, Xvalueundercrossing  
//string Yvalueundercrossing
//string Xvalueundercrossing
//for(k=0; k<npNW; k+=1)
   //for(j=0; j<npRW3; j+=1)
                //Yvalueundercrossing = "Yvalueundercrossings" + num2str(k)
        //Xvalueundercrossing = "Xvalueundercrossings" + num2str(k)
            //make/O/N= $Yvalueundercrossing
        //make/O/N $Xvalueundercrossing
        //wave destwave1 = $Yvalueundercrossing
        //wave destwave2 = $Xvalueundercrossing
        // if((rawwave3[j] > nextwave[k]) && (rawwave5[j] < crossing0))
                    //Yvalueundercrossing[count0] = rawwave5[j]
                       //destwave1 = rawwave5[j]
                    //destwave2 = rawwave3[j]
                    //Xvalueundercrossing[count0] = rawwave3[j]
                    //count0 += 1
              //endif
          //endfor
        //endfor



ChrLie wrote:
But what exactly are you asking for?

Hi ChrLie,

I have been trouble executing the calculations with the code that i have set up, it keeps giving me arrays, but all the values just turn out to be 0. Somehow I feel like either the code isnt going through all the crossings files or is doing so but overwriting the results. In the last forum place where i wrote the topic, i was asking for help in setting up the code to do the two main calculations described in the post.

Is the If-statement ever entered? I'd use the debugger to follow everything step by step.
I don't see where you use the variable crossing1.
ChrLie wrote:
Is the If-statement ever entered? I'd use the debugger to follow everything step by step.
I don't see where you use the variable crossing1.


I believe that ChrLie is correct. There are no points where rawwave5 (yvalues) is less than crossings 0 (value = 1). Unless the table display is truncating and rounding the values, all yvalues are greater than or equal to 1.
Thanks very much jtigor, and chrlie. You are right, I shall go over the code again, and make sure nothing weird is happening in the background with the table.
I never knew that Igor has the symbolic Debugger, I will use it and see what it says.

Thanks very much!