mvop.m

来自「一个很好用的摄像机标定程序」· M 代码 · 共 30 行

M
30
字号
function result = mvop(matrix, vector, op)%result = MVOP(matrix, vector, op)%%Apply a binary array operation on a matrix-vector pair%%Input:%  MATRIX - first argument (matrix M x N)%  VECTOR - second argument (vector M x 1 or 1 x N)%  OP     - binary array operation%%Output:%  RESULT - result of the operation applied to MATRIX and expanded VECTOR%%Example:%  matrix = reshape(1:12, 4, 3)'%  mvop(matrix, [1 2 3 4], '-')%  mvop(matrix, [1; 2; 3], './')%%Radim Halir, Charles University Prague, halir@ms.mff.cuni.cz%Created: 6.6.1997%Last modified: 6.6.1997[m, n] = size(matrix);if (size(vector, 1) == 1)  result = vector(ones(1, m), :);else      result = vector(:, ones(1, n));endresult = feval(op, matrix, result);

⌨️ 快捷键说明

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