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
 why is it?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

liujibao

China
Posts

Posted - 02/22/2004 :  09:49:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
void test()
{
string str,str1;
str1="data1";
//LT_execute("win -a data1");
Worksheet wks(str1);
Dataset tempcol(wks,0);
tempcol.GetName(str);
LT_execute("stat.ds.data$=str");//LT_execute("stat.ds.data$=tempcol");
LT_execute("stat.ds()");
double dbl1,dbl2;
dbl1=LabTalk.stat.ds.quartl25;
dbl2=LabTalk.stat.ds.quartl75;
int num=LabTalk.stat.ds.size;
}


why is it right sometimes,but is worong sometimes?

How to use stat.ds?
why is it both zero about dbl1 and dbl2?


Edited by - liujibao on 02/22/2004 10:22:43 AM

cpyang

USA
1406 Posts

Posted - 02/22/2004 :  10:50:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Maybe you should use pure C code.

To use LabTalk in OC code, you need to know LabTalk well.
your line

LT_execute("stat.ds.data$=str");

tells LabTalk that you are doing work with a Dataset called "Str", and I suppose there is no such dataset in your Origin session. More likely, you need to write code like

string strDataset;
strDataset = str1 + "_" + str; // assume that str = Col name

string strLT = "stat.ds.data$=" + strDataset;

LT_execute(strLT);


It looks like you need to do percentile calculation, maybe you can try the Data_percentiles function, which you can find by looking up OC Language Reference and Global Functions inside statistics.


CP




Go to Top of Page

liujibao

China
Posts

Posted - 02/23/2004 :  07:39:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This is a bug maybe !
When I debug the codes and the breakpoint is at the line:
LT_execute("stat.ds.data$=str");//LT_execute("stat.ds.data$=tempcol");

I find the value of thevariable "str" is "Data1_A",but the value of dbl1 and dbl2 are both zero.
When I modify my codes as cpyang said:
tempcol.GetName(str);
str.Format("stat.ds.data$=%s",str);

then,the value of "str" is yet "Data1_A", but the result are right.
Go to Top of Page

Iris_Bai

China
Posts

Posted - 02/24/2004 :  01:16:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
HI,
I cannot reproduce this problem. The following are my testing codes, could you try again?

void test()
{
Worksheet wks("Data1");
Column tempcol = wks.Columns(0);
string str, strPage;
wks.GetPage().GetName(strPage);
tempcol.GetName(str);

str = strPage + "_" + str;
str.Format("stat.ds.data$=%s",str);
LT_execute(str);
out_str(str);//Now, str is "stat.ds.data$=DATA1_A"
}


Iris
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