Vector array from matrix

1 Ansicht (letzte 30 Tage)
SANTHOSH s
SANTHOSH s am 29 Nov. 2019
Bearbeitet: Dhananjay Kumar am 4 Dez. 2019
Can anyone suggest me the general code for finding the difference between maximum and minimum value in a higher order matrix to get each row answers in vector form.
  2 Kommentare
JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH am 29 Nov. 2019
can you give a short example please?
dpb
dpb am 29 Nov. 2019
Use the optional argument to the min max functions to operate on the desired dimension...

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Dhananjay Kumar
Dhananjay Kumar am 4 Dez. 2019
Bearbeitet: Dhananjay Kumar am 4 Dez. 2019
If A = [1 0 5; 6 -9 -5; 1 2 5; 0 0.9 -2]
then min(A,[],2) gives a column vector containing minimum value of each row. Similarly for max(A,[],2).
>> min(A,[],2)
ans =
0
-9
1
-2
(Here third argument is to specify dimension along which to find min/max)

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by