Al momento, stai seguendo questo contributo
- Vedrai gli aggiornamenti nel tuo feed del contenuto seguito
- Potresti ricevere delle email a seconda delle tue preferenze per le comunicazioni
functions that allow functions to operate on the rows and coloums of matrixs. similiar to arrayfun and bsxfun.
Saves time having to implement for loops or figuring out how to vectorise your code
% matrixfun
% Y = matrixfun(hFunction,A,B,Dim)
%
% Invokes hFunction on the columns of matrices A and B.
% hFunction is a function handle that accepts two vectors.
% hFunction is invoked aCols*bCols times.
% Y is a cell matrix of size([aCols bCols]).
% If Dim is 2, hFunction operates on the rows of matrices A and B.
%
% Example
% A = [1 1 1; 2 2 2; 3 3 3]
% Y = matrixfun(@(X,Y)sum(X-Y),A,A);
% Y = [0] [0] [0]
% [0] [0] [0]
% [0] [0] [0]
%
% Y = matrixfun(@(X,Y)sum(X-Y),A,A,2); % = matrixfun(@(X,Y)sum(X-Y),A.',A.')
% Y = [0] [-3] [-6]
% [3] [ 0] [-3]
% [6] [ 3] [ 0]
%
Cita come
Pierce Brady (2026). matrixfunction (https://it.mathworks.com/matlabcentral/fileexchange/23146-matrixfunction), MATLAB Central File Exchange. Recuperato .
Informazioni generali
- Versione 1.1.0.0 (10,3 KB)
Compatibilità della release di MATLAB
- Compatibile con qualsiasi release
Compatibilità della piattaforma
- Windows
- macOS
- Linux
