I have a weird problem. I figured out a workaround, but I'd like to know why this is happening.
I'm looping through some columns in one workbook, calculating statistics, and putting results into cells of another workbook. Very simple. The output workbook is active throughout the loop. One the first loop, all goes well: stats show up in the first row. On the second pass through the loop, data from the first row gets erased, then data appears in the second row. On the third pass through the loop, data from the third row disappear and data appears in the third row. And so on. I used sec -e to pause at the bottom of the loop to make sure that's what's happening. Huh? Here's the problematic code:
loop(pIndex, 1, 4) {
range InputCols = [%(InputBookF$)](1:5)!$(pIndex+1);
stats ix:=InputCols mean:=Col(2)[pIndex] sd:=Col(3)[pIndex];
};
Here's code that works (nothing disappears):
loop(pIndex, 1, 4) {
range InputCols = [%(InputBookF$)](1:5)!$(pIndex+1);
stats ix:=InputCols mean:=AllMean sd:=AllSD;
Col(2)[pIndex] = AllMean;
Col(3)[pIndex] = AllSD;
};
The quantiles x-function does the same thing - stuff disappears when I move on to the next row if I don't put the output in a variable.
I'm using OriginPro 8.5 SR1 on Windows 7.