# Minmax

Jump to navigation
Jump to search

### Purpose

Scale rows or columns of a matrix to range from 0 to 1.

### Synopsis

- [xcorr,mins,maxs] = minmax(x,
*options*);

### Description

Scales rows (or columns) of a matrix (x) so each row (or column) has a minimum of 0 and a maximum of 1. The option "mode" specifies whether rows or columns are scaled to have unity range. Optional input (options) is described below.

### Inputs

**x**=*M*by*N*matrix of data to be scaled (class "double" or "dataset").

### Options

*options* = a structure array with the following fields:

**mode**: [ 1 ] dimension of data on which to calculate the minima and maxima for scaling. 1 = over rows (each row will have range [0,1]); 2 = over columns (each column will have range [0,1]). Default is 1.

### Outputs

**xcorr**= the scaled data (xcorr will be the same class as x)

**mins**= vector of minima for each row (or column)

**maxs**= vector of maxima for each row (or column)