MATLAB: Matlab fuction maximum and minimum MATLAB Write a MATLAB function that finds a 2D array and returns the sum of its minimum and maximum values WITHOUT USING "min" and "max" BUILT-IN FUNCTIONS. Best Answer I made a function, I hope help youa = rand(4); %Example of 2D matrixb = reshape(a,1,16);cont = 0; var = zeros(1,length(b));contM = 0;for n=1:length(b) b(n); for m = 1:length(b) if(b(n) > b(m)) cont = cont+1; elseif(b(n)< b(m)) contM = contM+1; end if(cont == 15) maximo = b(n); elseif (contM == 15) minimo = b(n); end end var(n) = cont; cont=0; contM=0;endsuma = minimo+maximo; Related SolutionsMATLAB: Make this matrix multiplication more efficient a = (B(1:n,:)*(A*b)).^2;You dimensions for B look a little strange to me, since your calculations do not use all of the rows of B (hence the B(1:n,:) reduction above). MATLAB: Help to print cell array in command window This is so hard to read so I'm just going to go off your subject line, how to print a cell array. Depending on what type of output you want, you can issue these commandsmyCellArray % no semicoloncelldisp(myCellArray);whos myCellArrayor print it out manually with fprintf(). Related QuestionContaing the especific number in the vectorSparse Block Matrix ConstructionHow to find a x values from this curve (the figure (10)) from the plotHow to terminate the loopSparse linear system of equations
Best Answer