function [shallow,deep] = marinaraTrench(arrayz)min=realmax;max=0;for i=1:size(arrayz) if arrayz(i)>max max=arrayz(i) end if arrayz(i)<min min=arrayz(i) endendshallow=mindeep=maxend
I'm trying to find the max and minimum values of an array using for loops alone and for some reason it's not always returning the right values
Best Answer