Making a Function for matrix

How can I write a function that takes a matrix input argument, calculates the difference bwtween maximum and mimuim valued elements in each row and gives a row vector as its output. see the following example
A = [1:4;5:8;9:12];
[x y] = minimax (A)
x = 3 3 3
y = 11

Respuestas (1)

KSSV
KSSV el 24 de Feb. de 2020
Editada: KSSV el 24 de Feb. de 2020

0 votos

iwant = (max(A,[],2)-min(A,[],2))'

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Feb. de 2020

Comentada:

el 27 de Feb. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by