How to add matrices in a function with varying input arguments
Ältere Kommentare anzeigen
I have a function: myfunction(varargin), where the varargin are matrices. I want this function to add all of the matrices I input. Hows the best way of doing this?
Akzeptierte Antwort
Weitere Antworten (1)
Azzi Abdelmalek
am 16 Jul. 2014
0 Stimmen
You can use one cell array containing all your matrices
3 Kommentare
Hail
am 16 Jul. 2014
Azzi Abdelmalek
am 16 Jul. 2014
M1=[1 2;3 4] % first matrix
M2=[1 2 3;0 1 0]% second matrix
M={M1,M2}
Use M as cell array, where
M{1} %is the first matrix
M{2} % the second matrix
Hail
am 16 Jul. 2014
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!