reading the last point of 300 waves
ThomasSLigon
NVAR maxWavesIn=root:maxWavesIn;
SVAR pathName=root:pathName;
String strNum="";
String fileName="";
String wName="";
Variable tempCount=0;
Variable tempVar =0;
Variable countIn=1;
WAVE LC;
countIn=1;
do
sprintf strNum, "%3.3d", countIn;
fileName = "TFC." + strNum + ".csv";
fileName = pathName + fileName;
LoadWave/J/O/W/A/D/L={0,0,0,0,4} fileName; //read first 4 columns of time course
LoadWave/J/O/W/A/D/L={0,0,0,24,3} fileName; //read last 3 columns of time course
wName="LC_" + strNum;
tempCount = numpnts($wName)-1;
//tempVar=wName[tempCount];
//tempVar=$wName[tempCount];
LC[countIn]=tempVar;
countIn = countIn+1;
while (countIn <= maxWavesIn);
SVAR pathName=root:pathName;
String strNum="";
String fileName="";
String wName="";
Variable tempCount=0;
Variable tempVar =0;
Variable countIn=1;
WAVE LC;
countIn=1;
do
sprintf strNum, "%3.3d", countIn;
fileName = "TFC." + strNum + ".csv";
fileName = pathName + fileName;
LoadWave/J/O/W/A/D/L={0,0,0,0,4} fileName; //read first 4 columns of time course
LoadWave/J/O/W/A/D/L={0,0,0,24,3} fileName; //read last 3 columns of time course
wName="LC_" + strNum;
tempCount = numpnts($wName)-1;
//tempVar=wName[tempCount];
//tempVar=$wName[tempCount];
LC[countIn]=tempVar;
countIn = countIn+1;
while (countIn <= maxWavesIn);
Thanks for any comments,
Tom
Here is a solution to your issue. The changes are marked with ***.
NVAR maxWavesIn=root:maxWavesIn;
SVAR pathName=root:pathName;
String strNum="";
String fileName="";
String wName="";
Variable tempCount=0;
Variable tempVar =0;
Variable countIn=1;
WAVE LC;
countIn=1;
do
sprintf strNum, "%3.3d", countIn;
fileName = "TFC." + strNum + ".csv";
fileName = pathName + fileName;
LoadWave/J/O/W/A/D/L={0,0,0,0,4} fileName; //read first 4 columns of time course
LoadWave/J/O/W/A/D/L={0,0,0,24,3} fileName; //read last 3 columns of time course
wName="LC_" + strNum;
Wave w = $wName // *** Create wave reference
tempCount = numpnts(w)-1; // ***
tempVar=w[tempCount]; // ***
LC[countIn]=tempVar;
countIn = countIn+1;
while (countIn <= maxWavesIn)
End
For details, execute:
March 29, 2013 at 10:52 am - Permalink
March 29, 2013 at 11:53 am - Permalink
thanks!! That works beautifully. And, after looking at it in the debugger, I changed it to
LC[countIn]=w[numpnts(w)-1]; // *** add last point of LC_nnn to LC
Tom
March 29, 2013 at 11:55 am - Permalink
inf-1 equals inf.
The technique of using inf to index a wave is not recommended. It will raise an error when running with rtGlobals=3.
March 29, 2013 at 01:28 pm - Permalink
Thanks for the heads up. As my procedure files have rtGlobas=1 I was not aware of this.
March 29, 2013 at 01:37 pm - Permalink