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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Return BasicStats structure?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mike Buess

USA
3037 Posts

Posted - 04/10/2003 :  2:20:10 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dataset dd;
--set up dd--
BasicStats bsStats;
Data_sum(&dd, &bsStats);

Currently I pass individual bsStats values back to LabTalk like this...

LT_set_var("v1", bsStats.N);
LT_set_var("v2", bsStats.total);
--etc.--

That works fine, but I'd rather return the entire bsStats structure and access its values in LabTalk like this...

v1 = something.N;
v2 = something.total;

Is that possible?

Mike Buess
Origin WebRing Member

srmcarneir

Brazil
33 Posts

Posted - 04/11/2003 :  1:44:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Would it be enough for you if you tried the Dataset::Update method? In the help files we can find a description showing that it "Update the Dataset object to or from the origin worksheet column", once your OriginC dataset is associated to an Origin worksheet. Regards.

Ricardo Carneiro
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 04/12/2003 :  12:57:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Ricardo,

I don't think Dataset::Update will do it. Data_sum(&dd,&bsStats) gets the basic statistics for Dataset dd and returns them in the bsStats structure...

bsStats.N // number of values
bsStats.total // sum
bsStats.mean // mean
-etc.-

I just want to access those statistics from LabTalk as is done with the LabTalk sum(dataset) command. So my basic question is this... can an Origin C command return a structure to LabTalk. If so, how is it done? The following function compiles OK...

BasicStats OC_sum()
{
Dataset dd;
--set up dd--
BasicStats bsStats;
Data_sum(&dd, &bsStats);
return &bsStats;
}

...but I don't know how (or if) it can be used in LabTalk.

Mike Buess
Origin WebRing Member
Go to Top of Page

easwar

USA
1965 Posts

Posted - 04/12/2003 :  9:16:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

Currently there is no support for passing a structure between OC and LabTalk. So you will need to set LT variable values like you are doing now.

However, specifically for basic stats, you could have a function such as below to execute the sum command in LT so that the stats are readily available in LT once this function is called.


void OC_sum(Dataset& dd)
{
string strCMD = "sum(" + dd.GetName() + ");";
LT_execute(strCMD);
}



Easwar
OriginLab.



Edited by - easwar on 04/12/2003 9:40:48 PM

Edited by - easwar on 04/12/2003 9:41:46 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000