The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Filling blank cells with the previous cell value

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

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];
}

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000