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
 Origin Forum
 convert NANUM to 0 via script

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
DmitriyElets Posted - 11/10/2018 : 1:02:55 PM
Origin Ver. 9.0

How can I convert NANUM to number (for ex. 0) using script window (set column values window) in the way, that allows to work with result as with number/column/dataset?

If I write something like
ISNA(col(AR1)) ? 0 : col(AR1)
it set 0 in the cells, corresponding to NANUM values.

But if I don't want to make new column every time for NANUM->0 converted values and write something like
2*ISNA(col(AR1)) ? 0 : col(AR1)
or do mote complicated expressions, then I get an error: "Math cannot be performed on Text column"

I know how to do in in OriginC, but may be somebody knows the way to do it via script window functions?
3   L A T E S T    R E P L I E S    (Newest First)
nick_n Posted - 11/11/2018 : 09:18:57 AM
However, that will work faster:
int jj;
loop (jj, wks.c1, wks.c2)
{
	wcol(jj)=treplace(wcol(jj), 0/0, 0, 2);
}


Nikolay
couturier Posted - 11/10/2018 : 4:25:14 PM
You can save 1 loop with this:

int jj;
loop (jj, wks.c1, wks.c2)
{
	range rCol=$(jj);
	rCol=rCol==0/0?0:rCol;
}
nick_n Posted - 11/10/2018 : 3:55:56 PM
Hi,

Try:

int ii, jj;

loop (jj, wks.c1, wks.c2)
{
	loop (ii, 1, wks.maxrows)
	{
		string currCell$=wcol(jj)[ii]$;
		if (currCell$=="" || currCell$=="--") wcol(jj)[ii]=0;
	}
}


It will replace NANUM with 0 in selected columns. Best regards,

Nikolay

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