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
 Simple Q: how do you get the index of a cell?

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
northpig87 Posted - 05/01/2009 : 12:55:28 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8.0891
Operating System: WinXP

Hello all,

a part of my code can look through a column and find the max value and write it out to a cell fro number of worksheet...now I also want to know the row number where that maximum value was at. How do I do that?

Column col_temp(wksData,2);
Dataset maxfittedy(col_temp);
double maxpeak;
maxpeak=max(maxfittedy);

this is what I did to find the max value of Column #2 of wksData and stored it in a double maxpeak. very simple (i'm totally beginner).

so what can I do to find the position of this max value returned by max(maxfittedy)?

Thank you very much!!!!!
1   L A T E S T    R E P L I E S    (Newest First)
cjfraz Posted - 05/05/2009 : 11:35:59 PM
There's probably several valid ways to do this, but my suggestion would be to use the GetMinMax method of the vector class as it will easily return indices...

void bb(){
	Dataset dsTemp("Book1",1);
	uint indexMin,indexMax;
	double dMin, dMax;
	dsTemp.GetMinMax(dMin, dMax, &indexMin, &indexMax);
	printf("min: %3.2f\nmax: %3.2f\niMin: %i\niMax: %i", dMin, dMax, indexMin, indexMax);
}



J...

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