Vector array from matrix

3 次查看(过去 30 天)
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 个评论
JESUS DAVID ARIZA ROYETH
can you give a short example please?
dpb
dpb 2019-11-29
Use the optional argument to the min max functions to operate on the desired dimension...

请先登录,再进行评论。

采纳的回答

Dhananjay Kumar
Dhananjay Kumar 2019-12-4
编辑:Dhananjay Kumar 2019-12-4
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by