Making a Function for matrix

1 回表示 (過去 30 日間)
Manosh Chandra Haldar
Manosh Chandra Haldar 2020 年 2 月 24 日
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
  1 件のコメント
madhan ravi
madhan ravi 2020 年 2 月 24 日
What’s 11?

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2020 年 2 月 24 日
編集済み: KSSV 2020 年 2 月 24 日
iwant = (max(A,[],2)-min(A,[],2))'
  1 件のコメント
Manosh Chandra Haldar
Manosh Chandra Haldar 2020 年 2 月 27 日
Thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by