📄 mvop.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -