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
 Forum for Origin C
 add method

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
ovince Posted - 10/08/2006 : 5:09:05 PM
hi All,

I have a worksheet "wks" with 2 columns. I have read out these columns into datasets A and B.

I would like to create 2 datasets ("D1" and "D2") from A in a such a way that D1 contains rows of A under condition B<4.5 and D2 to contain rows of A under condition B>4.5. I have started in this way but it does not work

Dataset A(wks, 0);
Dataset B(wks, 1);

Dataset D1;
Dataset D2;

int n;
n= A.GetSize();

int count1=0;
int count2=0;
for(int ii = 0; ii<n; ii++)
{
if (B[ii] < 4.5)
{
D1.Add(A[ii]);
count1++;
} else {
D2.Add(A[ii]);
count2++;
}
}

Why this does not work? And how to make realisation of this idea simpier?


Thanks
Oliver
1   L A T E S T    R E P L I E S    (Newest First)
rlewis Posted - 10/08/2006 : 7:10:32 PM
Your code fails because the declarations "Dataset D1; Dataset D2;" do NOT create valid dataset objects. The simplest solution is to add the lines " D1.Create(0,1); D2.Create(0,1);" after declaring D1 and D2 as dataset objects.

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