maxvalue.m

来自「Diversos ejemplos sobre la aplicacion de」· M 代码 · 共 24 行

M
24
字号
function [maxval, rmax, cmax] = maxvalue(A);
  % function [maxvalue, rmax, cmax] = maxvalue(A);
  %  brief description of function here
  
  %
  % Inputs 
  %     A:  a matrix of size r x c, with r rows and c columns
  %
  % Outputs
  %     maxvalue:  largest entry in A
  %     rmax, cmax: integers specifying the (row,column) 
% 			location of the max value

% Get a row vector containing the maximum value within each column 
% Store idx_row - a vector containing the location of 
% the maximum within the column 
[mx_row, idx_row] = max(A);

% find the maximum within this vector
[maxval, cmax] = max(mx_row);

% Use the idx_row to find the row location of the max
rmax = idx_row(cmax);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?