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
 Origin Forum
 how to get number from wks in origin C

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
holdqian Posted - 06/17/2023 : 09:44:17 AM
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.
4   L A T E S T    R E P L I E S    (Newest First)
holdqian Posted - 06/18/2023 : 10:35:52 PM
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.
aplotnikov Posted - 06/18/2023 : 12:59:31 PM
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.
holdqian Posted - 06/18/2023 : 09:24:10 AM
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.
aplotnikov Posted - 06/17/2023 : 10:16:40 AM
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.

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