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
 matrix maximum value readout

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
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

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