Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
ywh
Posted - 11/12/2014 : 2:42:55 PM Origin Ver. and Service Release (Select Help-->About Origin): Operating System:
Hi there. I'm new to Origin and would like some help/guidance on how to do the following:
I have a column of numbers that serve as an indicator. Most of the numbers are 1s, with occasional 10s. I want to make a new column that has mostly 1s, but when it sees a 10 in the indicator column, I want the next 2500 numbers to be 2. Say the column of indicator is col(K), and the new column I will make is col(F). I have written the following script, but it didn't work. Any help will be appreciated. Thanks a lot! --------------------------------------------------------- int flag= 0; int counter = 0;
for (ii=0; ii< 20000; ii++) { if ( col(K)[ii] == 10 ) { flag = 1; counter = 0; } if (flag == 1) { if (counter < 2500) { col(L)[ii] = 2; } else { flag = 0; } } counter++; }
2 L A T E S T R E P L I E S (Newest First)
ywh
Posted - 11/13/2014 : 1:38:53 PM Thanks a lot!
lkb0221
Posted - 11/12/2014 : 3:56:44 PM int ReplaceWin = 2500; range rIndicator = col(K); range rTarget = col(L);
int Value = 1; int counter = 0; for (int ii = 1; ii <= 20000; ii++) { rTarget[ii] = Value;
if (counter > 0) { counter = counter - 1; } else { Value = 1; }
if (rIndicator[ii] == 10) { Value = 2; counter = ReplaceWin - 1; } }