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
 Missing Values makes calculation wrong

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
JThieser Posted - 07/12/2012 : 12:16:04 PM
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:
Hey,
when i multiply several coloums to a new colunm i have the problem that when in one of these colunms are missing values the calculation doesn't work...
How is it possible that in this case Origin just neglect this missing value??

Thanks a lot

Jim
2   L A T E S T    R E P L I E S    (Newest First)
JThieser Posted - 07/16/2012 : 04:24:39 AM
Thanks!!!
Penn Posted - 07/15/2012 : 11:08:25 PM
Hi Jim,

I am afraid that it cannot just multiply the columns directly. You can refer to the following script, which can be put into the Before Formula Scripts panel in the Set Value dialog. This script will get the result row by row after checking the missing values.

range aa = 1;  // column 1
range bb = 2;  // column 2
range cc = 3;  // column 3
range dd = 4;  // column 4
for(ii=1; ii<=wks.nrows; ii++)
{
	double aa1 = aa[ii]==1/0?1:aa[ii];  // if missing, consider as 1
	double bb1 = bb[ii]==1/0?1:bb[ii];
	double cc1 = cc[ii]==1/0?1:cc[ii];
	if(aa[ii]==1/0 && bb[ii]==1/0 && cc[ii]==1/0)  // if all are missing values
		dd[ii] = 1/0;  // result is missing value
	else
		dd[ii] = aa1*bb1*cc1;  // multiply
}



Penn

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