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
 Origin Forum
 how to get number from wks in origin C
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

holdqian

China
4 Posts

Posted - 06/17/2023 :  09:44:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
origin ver.2018

Hello everyone!
Recently I try to define a function, there is a constant which is a specific data in the worksheet, I know I can define it as a constant and change value when I using other data, but it seems really troublesome. I don't konw how to get this number from worksheet. I am not familiar with origin C, I need some help. I also check "Get & Set Numeric Data Values from Column", but I still do not understand.
The formula I try to edit in origin C:



I edit the following program, E is the constant I have mentioned in above.
// Beginning of editable part
 int n;
 double y0;
 double dPrecision = 1e-6;
 y = E;
 
 
 
 
 do
 {
 n++;
 y0 = ( -(x/t)^a )^n /( gamma(1+a*n) );
 y = E*y0 + y ;
 
 }
 while((E*y0/y) > dPrecision);



Regards.

aplotnikov

Germany
160 Posts

Posted - 06/17/2023 :  10:16:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
I am not familiar with origin C, I need some help.

Some help:
https://www.originlab.com/doc/OriginC
https://www.originlab.com/doc/en/OriginC/guide/Worksheet-Column-Data-Manipulation


Worksheet wks("<worksheet_name>");
Dataset ds(wks, <col_nr>);
int ii;
ii=...;
ds[ii]=...;


What exactly is the problem?

PS. There is a separate forum on OriginC https://my.originlab.com/forum/forum.asp?FORUM_ID=12.

Edited by - aplotnikov on 06/17/2023 10:34:50 AM
Go to Top of Page

holdqian

China
4 Posts

Posted - 06/18/2023 :  09:24:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:


What exactly is the problem?



Hi,aplotnikov!
Thank you for your reply!

I'm sorry I didn't clearly describe the problem.

First, I would like to know how to get one numerical value from my worksheet, for example I want to get the numerical value in row 1 and column A, and then assign this numerical value to a parameter called E
Second, I would like to ask for your advice about my program, I am using the fitting function builder with Origin C as function type.
The function I want to define show in first post of this TOPIC.
Could you help me check if my program is reasonable.
void _nlsfMLsample(
// Fit Parameter(s):
double a, double t, double E,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
	// Beginning of editable part
	int n;
	double y0;
	double dPrecision = 1e-6;
	y = E;
	
	do
	{
	n++;
	y0 = ( -(x/t)^a )^n /( gamma(1+a*n) );
	y = E*y0 + y ;
	}
	while((E*y0/y) > dPrecision);
	// End of editable part
}


I'm looking forward to your reply.
Regards.
Go to Top of Page

aplotnikov

Germany
160 Posts

Posted - 06/18/2023 :  12:59:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can find the solution in my previous reply. Try to read it carefully once again. Or just wait for a reply from Originlab. I cannot help you anymore, sorry.
Go to Top of Page

holdqian

China
4 Posts

Posted - 06/18/2023 :  10:35:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by aplotnikov

You can find the solution in my previous reply. Try to read it carefully once again. Or just wait for a reply from Originlab. I cannot help you anymore, sorry.



Thank you very much,aplotnikov!
I use your code and check HELP to realise it, then I succeed!
Here is the code:
	Worksheet wks = Project.ActiveLayer();
	
	Dataset ds(wks,1);
	
	int ii;
	ii=0;
	A=ds[ii];
	y=A*x;//for example

(Actually at first I did't realise the meaning of your code, so I ask you again)

I still have a question, when I use your code:
Worksheet wks("<worksheet_name>");

I don't know what should I enter in ("<worksheet_name>"),
I try these code:
Worksheet wks("<worksheet_Sheet1>");

Worksheet wks("<Sheet1>");

They all failed.
Thanks again!

Regards.

Edited by - holdqian on 06/19/2023 05:28:19 AM
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