T O P I C R E V I E W |
rowed79 |
Posted - 08/19/2013 : 10:34:17 AM Origin Ver. and Service Release : OriginPro 9.0.0 Operating System: Win7 Pro SP1
Hello,
I have a column of data which only fills the cell when there's a change in the previous value. However, I need to have all the cells in the column filled, such that if there's a blank cell, it's filled by the value of the cell directly above it. I'm trying to write this into a simple script that I can run in LabTalk during a batch import using the import wizard. This is my first attempt, acknowledgedly poor:
if (col(b)[i] == NANUM) col(b)[i] = col(b)[i-1];
Full disclosure, I'm a LabTalk novice at best, but I'm trying to learn quickly. Any help would be very much appreciated.
Regards, Dave
--Dave |
1 L A T E S T R E P L I E S (Newest First) |
greg |
Posted - 08/19/2013 : 4:51:01 PM Assuming that the first row always has a value, the script could be: range rab = col(b); val = rab[1]; loop(ii,2,rab.GetSize()) { if(rab[ii]==NANUM) rab[ii]=val; else val = rab[ii]; }
Otherwise you can pick some arbitrary value: range rab = col(b); val = 0; // This be used until a real value is found loop(ii,2,rab.GetSize()) { if(rab[ii]==NANUM) rab[ii]=val; else val = rab[ii]; }
|
|
|