T O P I C R E V I E W |
tinkusch |
Posted - 08/07/2009 : 11:50:11 AM Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 8G SR6 (v8.0988) Operating System: XP
Hi folks, I try to read the max value from an origin matrix into an origin variable. The following c function works so far
void EX1(string MNAME) { double dMax; Matrix matA; matA.Attach(MNAME); dMax = matA.GetMax(); printf("Max of Matrix1: %g\n", dMax); }
but does not solve the problem completely.
MNAME is an existing Origin matrix containing doubles.
The version below using return does not work:
double EX2(string MNAME) { double dMax; Matrix matA; matA.Attach(MNAME); dMax = matA.GetMax(); return dMax; }
I always get the error message "Unattached wrapper class..." when I call this function in the ORIGIN script window or a LabTalk script, as: EX2(MNAME)=; or VAL = EX2(MNAME);
Can somebody please help me finding the solution.
By the way, the following function compiled and worked perfectly in PRO 7.5, but does not in Pro 8 SR6:
float MatMax(string MNAME) { double dMax; Matrix mat(MNAME); dMin = mat.GetMin(); return dMax; }
Seems, there was a slight change in the declaration syntax from (Pro 7.5): Matrix mat(MNAME); to (Pro 8): Matrix matA; matA.Attach(MNAME);
Any help and comments welcome, thanks Stefan |
1 L A T E S T R E P L I E S (Newest First) |
Iris_Bai |
Posted - 08/09/2009 : 11:05:31 PM Hi Stefan,
Seems this is a bug, have tracker it to #14111. From Origin80, we improve the stardard for the calling in Commad Window. For string type variable, can input value without quotation marks in Origin 75, but in 80, need to add quotation marks to follow stardard. I assume you call functions may like EX2(MBook1)= just like in Origin 75. So if run EX2("MBook1")= will get result without error.
Iris |
|
|