Find minimum and maximum for each row, MATLAB in Mathematics

Find Minimum and Maximum for each row

To find the maximum (or minimum) for each row, the dimension of 2 (that is how a MATLAB refers to rows) can be identified as the third argument to the max (or min) function; the second argument should be an empty vector:

>> min(mat,[],2)

ans =

   5

   9

Such functions can also compare vectors or matrices and return the maximum (or minimum) values from corresponding elements. For illustration, the below iterates through all elements in the two vectors, comparing equivalent elements and returning the minimum for each:

>> x = [3 5 8 2 11];

>> y = [2 6 4 5 10];

>> min(x,y)

ans =

2 5 4 2 10

A few of the other functions in the datafun help topic which have been explained already involve cumsum, sum, prod, cumprod, and hist.

Posted Date: 10/22/2012 6:56:35 AM | Location : United States







Related Discussions:- Find minimum and maximum for each row, Assignment Help, Ask Question on Find minimum and maximum for each row, Get Answer, Expert's Help, Find minimum and maximum for each row Discussions

Write discussion on Find minimum and maximum for each row
Your posts are moderated
Related Questions
Labels and Prompts: The script loads all the numbers from file into a row vector. It then splits the vector; it stores the initial element that is the experiment number in a v

Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

Pie chart - plot functions: The MATLAB also has a function pie which will generate a pie chart. Calling the function with the form pie (vec) draws a pie chart, by using the pe

Writing to Files: There are many lower level functions which can write to files. We will focus on the fprintf function that can be used to write a file and also to append to a

Recursive Functions: The Recursion occurs whenever something is defined in terms of itself. In the programming, a recursive function is a function which calls itself. The Recu

bar and barh functions: For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown: rm = randint(2,4,[1

Structure Consisting of the Fields A MATLAB can also solve the sets of equations. In this illustration, the solutions for x, y, & z are returned as a structure consisting of th

Three-Dimensional Plots: The MATLAB has many functions which will display three-dimensional plots. Most of these functions have similar name as corresponding two-dimensional p

Creating Customized strings: There are many built-in functions which create customized strings, including blanks, char, and sprintf. We know that the char function can be u

Function fopen - file function: The permission string in the call to the fopen function identifies that the file is opened for writing to it. Just as when reading from a file,