主要内容

min

Return minimum values in DataMatrix object

Description

M = min(DMObj1) returns the minimum values in DMObj1, a DataMatrix object.

example

[M, Indices] = min(DMObj1) also returns Indices, the indices of the minimum values in DMObj1.

example

[M,Indices,Names] = min(DMObj1) also returns Names, a vector of the row or column names corresponding to the minimum value in each column or each row of DMObj1.

example

___ = min(DMObj1,[],Dim) specifies which dimension to return the minimum values for in a DataMatrix object for any of the previous output arguments.

example

MA = min(DMObj1,DMObj2) returns MA, a numeric array containing the smaller of the two values from each position of DMObj1 and DMObj2.

example

Examples

collapse all

Load the MAT-file, provided with the software, that contains yeast data. This MAT-file includes three variables: yeastvalues, a 614-by-7 matrix of gene expression data, genes, a cell array of 614 GenBank® accession numbers for labeling the rows in yeastvalues, and times, a 1-by-7 vector of time values for labeling the columns in yeastvalues.

load filteredyeastdata

Create two subsets of the data.

yeastvalues2 = yeastvalues(1:5,:);
genes2 = genes(1:5,:);
dm1 = bioma.data.DataMatrix(yeastvalues2,genes2,times)
dm1 = 

                  0       9.5     11.5      13.5      15.5      18.5      20.5  
    SS DNA     -0.131    1.699    -0.026     0.365    -0.246     0.478     0.435
    YAL003W     0.305    0.146    -0.129    -0.444    -0.707    -1.499    -1.935
    YAL012W     0.157    0.175     0.467    -0.379     -0.52    -1.279    -2.125
    YAL026C     0.246    0.796     0.384     0.981      1.02     1.646     1.157
    YAL034C    -0.235    0.487    -0.184    -0.669    -1.006     2.369     2.611
yeastvalues3 = yeastvalues(6:10,:);
genes3 = genes(6:10,:);
dm2 = bioma.data.DataMatrix(yeastvalues3,genes3,times)
dm2 = 

                  0       9.5      11.5      13.5      15.5      18.5      20.5  
    YAL061W    -0.532     0.028    -0.333    -0.102     1.172     2.087     0.992
    YAR027W    -0.003     0.522     0.347     0.806     0.756     1.949     1.065
    YAR073W     0.395     0.536     0.422     0.113    -0.226    -1.681    -1.857
    YBR006W    -0.665    -0.724     0.419     0.505     0.499      1.53     1.755
    YBR018C    -0.619    -1.682    -0.043     -0.37    -0.767      0.75     0.903

Get the minimum value from each column, that is, dimension = 1.

[m1,indices1,names1] = min(dm1)
m1 = 1×7

   -0.2350    0.1460   -0.1840   -0.6690   -1.0060   -1.4990   -2.1250

indices1 = 1×7

     5     2     5     5     5     2     3

names1 = 1×7 cell
    {'YAL034C'}    {'YAL003W'}    {'YAL034C'}    {'YAL034C'}    {'YAL034C'}    {'YAL003W'}    {'YAL012W'}

Get the minimum value from each row, that is, dimension = 2.

[m2,indices2,names2] = min(dm1,[],2)
m2 = 5×1

   -0.2460
   -1.9350
   -2.1250
    0.2460
   -1.0060

indices2 = 5×1

     5
     7
     7
     1
     5

names2 = 5×1 cell
    {'15.5'}
    {'20.5'}
    {'20.5'}
    {'   0'}
    {'15.5'}

Compare two DataMatrix and get the smaller value for each element.

MA = min(dm1,dm2)
MA = 5×7

   -0.5320    0.0280   -0.3330   -0.1020   -0.2460    0.4780    0.4350
   -0.0030    0.1460   -0.1290   -0.4440   -0.7070   -1.4990   -1.9350
    0.1570    0.1750    0.4220   -0.3790   -0.5200   -1.6810   -2.1250
   -0.6650   -0.7240    0.3840    0.5050    0.4990    1.5300    1.1570
   -0.6190   -1.6820   -0.1840   -0.6690   -1.0060    0.7500    0.9030

Input Arguments

collapse all

DataMatrix, specified as a bioma.data.DataMatrix object.

DataMatrix, specified as a bioma.data.DataMatrix object.

Dimension of DataMatrix to return the minimum values for, specified as 1 or 2.

If Dim is 1, the function returns a row vector containing minimum value for each column. If Dim is 2, the function returns a column vector containing a minimum value for each row.

Output Arguments

collapse all

Minimum value, returned as one of the following:

  • Scalar specifying the minimum value in DMObj1 when DMObj1 contains vector of data

  • Row vector containing the minimum value for each column in DMObj1 when DMObj1 is a matrix and Dim = 1.

  • Column vector containing the minimum value for each row in DMObj1 when DMObj1 is a matrix and Dim = 2.

Data Types: double

Indices of minimum values, returned as one of the following:

  • Positive integer specifying the index of the minimum value in a DataMatrix object containing a vector of data

  • Vector containing the indices for the minimum value in each column, if Dim = 1, or in each row, if Dim = 2, in a DataMatrix object containing a matrix of data

Row or column names, returned as a cell array of character vectors.

The function returns a vector of the row names if Dim = 1) or column names if Dim = 2, corresponding to the minimum value in each column or each row of DMObj1. If there are multiple minimum values in a column or row, the row or column name for the first value is returned.

Data Types: char | string

Numeric output, returned as a numeric array containing the smaller of the two values from each position of DMObj1 and DMObj2.

DMObj1 and DMObj2 can both be DataMatrix objects, or one can be a DataMatrix object and the other a numeric array. They must be the same size, unless one is a scalar. MA has the same size (number of rows and columns) as the first nonscalar input.

Data Types: double

Version History

Introduced in R2008b

See Also

| |