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
 matrix maximum value readout
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tinkusch

Germany
94 Posts

Posted - 08/07/2009 :  11:50:11 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Iris_Bai

China
Posts

Posted - 08/09/2009 :  11:05:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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