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 for Programming
 Forum for Origin C
 Calling my own code from a fitting function

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
sjwerkema Posted - 01/30/2016 : 8:05:20 PM
Origin Ver. and Service Release: 8.6.0 (64-bit) Sr3
Operating System: Windows 7

I am trying to create a user-defined fitting function that calls functions that I've written in Origin C. If I include the header file that contains the declarations I need and my function prototypes, I get a "Error, duplicate variable names in declaration" error for the first declaration in the header file when I attempt to compile. If I don't include this header, the compiler complains because it can't find my functions. What is the procedure for using my own code in a fitting function?


Steve Werkema
Fermi National Accelerator Laboratory
3   L A T E S T    R E P L I E S    (Newest First)
jasonzhao Posted - 02/01/2016 : 9:26:54 PM
Hello,

In fact Origin has the fact function internal,
http://www.originlab.com/doc/LabTalk/ref/Fact-func
you can call it directly in your function expression;

If you write the fact function by yourself, you may need to consider the data type, because in Origin C fitting function, the parameter has a default type of double, but your Fact function has a return type of int, you may need to convert, if necessary.

and if you want us to check the file, you can send to tech@originlab.com.


Best regards!
Jason
OriginLab Technical Service
sjwerkema Posted - 02/01/2016 : 09:05:43 AM
Hi Jason,

Thanks for the quick response.

The path of my header file and correspoonding '.c' file is:
Z:\Projects\Origin\OriginC\ProjectTemp\MagnetMeasurementAnalysis.h
Z:\Projects\Origin\OriginC\ProjectTemp\MagnetMeasurementAnalysis.c

Z: is a network drive.

These files show up in my Origin User folder and build without error. I can use functions defined in MagnetMeasurementAnalysis.c to set column values for worksheets that are in my project.

I include these files in my fitting function with the statement:
#include "Z:\Projects\Origin\OriginC\ProjectTemp\MagnetMeasurementAnalysis.h"

The prototype statement (in MagnetMeasurementAnalysis.h) for the function I use in my fitting function is:
int Fact(int n);

I can email the code to you if that would help.

Regards,



Steve Werkema
Fermi National Accelerator Laboratory
jasonzhao Posted - 02/01/2016 : 05:09:43 AM
Hello,

Would you please tell me the path of your 'header file' and corresponding '.c' file,
and the code of how do you include the header file that contains the declarations,
and it's better to show us the prototype of the Origin C function.

Best regards!
Jason
OriginLab Technical Service

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