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
 LabTalk Forum
 apply an origin c function on a dataset
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peroma

Germany
26 Posts

Posted - 01/31/2003 :  08:06:30 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have made an origin c function for the calculation of a dataset. But I don't know, how to call the function so that the values of a complete dataset will be calculated. I cannot believe that the only way is, to write a loop so that each value is calculated separately.

Can anyone help me with the correct syntax?

Thanks,
Peter

easwar

USA
1965 Posts

Posted - 01/31/2003 :  12:20:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Peter,

You can pass a whole dataset to the function and OC will know to deal with it correctly.

For example, if you have the following function in OC:

double myfunc(double x)
{
return x*2;
}


you can then go to script window and type
myfunc(3)=
and you will get 6.
Also, you can type in script window:
data1_b = myfunc(data1_a)
and column b will have values double of column a.

Note that you can also do the above within OC itself.
For example, you can call your previous function in another OC function, such as:


void dd()
{
Dataset ds1("Data1_A");
Dataset ds2("Data1_B");

ds2=myfunc(ds1);
}


Easwar
OriginLab.

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