MATLAB: What's [Y,I]=max(AS,[],2);?

后端 未结 5 1228
傲寒
傲寒 2021-01-20 17:37

I just started matlab and need to finish this program really fast, so I don\'t have time to go through all the tutorials.

can someone familiar with it please explain

5条回答
  •  我在风中等你
    2021-01-20 18:21

    C = max(A,[],dim) returns the largest elements along the dimension of A specified by scalar dim. For example, max(A,[],1) produces the maximum values along the first dimension (the rows) of A.

    Also, the [C, I] = max(...) form gives you the maximum values in C, and their indices (i.e. locations) in I.

    Why don't you try an example, like this? Type it into MATLAB and see what you get. It should make things much easier to see.

    m = [[1;6;2] [5;8;0] [9;3;5]]
    max(m,[],2)
    

提交回复
热议问题