Author |
Topic  |
|
Kstadler
Germany
Posts |
Posted - 08/22/2007 : 10:21:42 AM
|
Origin Version (Select Help-->About Origin): v7 Operating System: Windows 2000
Hi,
during programming a function to find the 20 and 80% values of a slope of a peak I encountered the following problem: The function curve_xfromY() gives me the x value of a specified y, but when I have several equal y values at different x values, Murphy's law demand its right and a get the "wrong" x value. Can I somehow tell curve_xfromY that it should take a value "near" a certain index or x value?
Many thanks in advance Konstantin Stadler |
|
rlewis
Canada
253 Posts |
Posted - 08/22/2007 : 10:47:29 AM
|
How about constructing a temporaty curve withing the given x range and then using curve_xfromY .... In principle this could be doable with the following curve constructor that I lifted from the help section
Curve::Curve Prototype: PUBLIC Curve(curvebase &cv, int &nNumMissingInCopy, int &nSrcOffset, DWORD dwOptions = 0, int nLower = -1, int nUpper = -1) Remarks: It creates a temporary curve object from the supplied source. Parameters: cv = [in] source curve nNumMissingInCopy = [output] number of missing values in the created curve. nSrcOffset = index in source curve that the result curve's 1st point is copied from dwOptions = a combination of values from the enumeration: enum { CURVECOPY_SCAN_OVER_MISSING_FROM_LEFT = 0x00000001, // if on, it will scan from the left (see the parameter nLower) until it finds the first nonmissing value CURVECOPY_SCAN_OVER_MISSING_FROM_RIGHT = 0x00000002, // if on, it will scan back from the right (see the parameter nUpper) until it finds the first nonmissing value CURVECOPY_SKIP_MISSING_INSIDE = 0x00000004, // if on, it will not copy any missing values found in the middle CURVECOPY_REPLACE_MISSING_INSIDE = 0x00000008, // if on, any missing values in the middle will be replaced with the average of neighboring points (not used if the bit CURVECOPY_SKIP_MISSING_INSIDE is on) }; nLower = lower index to start from or -1 to start from the lower bound. nUpper = upper index to end at, or -1 to end at the upper bound. Return values: Example: Summary: Sample data: Header file: curve.h See also:
|
 |
|
zachary_origin
China
Posts |
Posted - 08/22/2007 : 7:52:44 PM
|
Perhaps you can add a new curve_xfromY() function with different parameters from the default one as your own need... The corresponding files for the declaration and definition are data.h and internal.c, which are both located in the folder of OriginPro75_Installation_Folder\OriginC\system\.
|
 |
|
Kstadler
Germany
Posts |
Posted - 08/23/2007 : 06:27:34 AM
|
Hi rlewis,
I tried to make a curve copy, but then I got the following Error Massage: Error, Can't find matching constructor probably because I do not have a curve.h in my system folder. I use v7.0383 (B383) - could it be, that curve.h is a new header for v7.5?
Many thanks, Konstantin |
 |
|
larry_lan
China
Posts |
Posted - 08/30/2007 : 10:43:23 PM
|
Yes, curve.h is a new header in Origin 7.5. Maybe you can download a demo 7.5 to get all new .c and .h files? :-)
Thanks Larry OriginLab Technical Services
Edited by - larry_lan on 08/30/2007 10:43:52 PM |
 |
|
|
Topic  |
|
|
|