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
 get number of rows
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ase724

USA
9 Posts

Posted - 11/05/2012 :  4:26:55 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.6
Operating System: Windows7

Hi,

I am trying to do curve fitting using an external dll function. I am using Visual Studio 2010 to write the C code for the dll function. I need to know the number of rows in the worksheet in order to do the calculation. Each data set (each worksheet/workbook) has several columns with the same number of rows, however, each data set was taken for various time period so different data set contains different number of rows. How do I write the C code (in the dll function) to get the number of rows in the worksheet? Thanks in advance!

Penn

China
644 Posts

Posted - 11/06/2012 :  12:59:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The external dll function is not dependent on Origin, so, it is not able to get the number of rows in the worksheet. However, you can try the workaround by adding one more parameter for your fitting function, and this added parameter will be the number of rows of the worksheet. And when you uses this dll to perform fitting, you can specify this parameter with the number of rows in worksheet, and then fix this parameter.

Penn
Go to Top of Page

ase724

USA
9 Posts

Posted - 11/06/2012 :  02:33:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Penn,

Thank you very much for your quick reply. I have another difficulty in dll fitting function. I want to fit a function y (one column in my worksheet) with two variables, x1 and x2 (two columns in my worksheet). In my calculation I use 2D arrays so I want to set variables x1 and x2 as arrays. The dll fitting example from Origin has the syntax:

#define x1 x[1]
#define x2 x[2]

but when I compile it the computer doesn't recognize them as arrays. Is there a way to make the variables become arrays or vectors? Thanks!
Go to Top of Page

Penn

China
644 Posts

Posted - 11/07/2012 :  03:17:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can see the definition in the FitFuncDef.h file, and x is for the input independent variables, that is to say, x[1] is for the first independent variable, x[2] is for the second, etc. The example you mentioned is the fitting function for two independent variables. So, it is not the thing like array or vector you mentioned. Also, it is not able to make the variables (x1 and x2), as you mentioned, become array or vector.

Penn
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