Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max Value of Array 2

Status
Not open for further replies.

ellipm

Programmer
Apr 19, 2012
7
Hello again,
I was wondering if sb knows how can i calculate the max value of an array. This is what I mean:
Code:
IF(U(I+1,J).LE.UMEAN(I+1)) then 
YUHALF(I+1)=(J-2)*DY+((Y(J)-Y(J-1))/(U(I+1,J)-U(I+1,J-1)))*(UMEAN(I+1)-U(I+1,J-1))    
write(*,*) 'i=',i+1,'j=',j,'yuhalf=',yuhalf(I+1)
	end if

I have calculated some values for my array "YUHALF" and I want the first of them,which happens to be the max value. Because of the if-statement, I don't know in which j it happens in every step.
Any advice is much appreciated!thanks
 
it seems very useful!i'll try it.thanks!
 
Indeed you can explore maxval intrinsic function. If you store the values of your array in YUHALf then maxval(YUHALF) can give you the max. value. You might use the maxloc function also to know the location of the maximum value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top