Multiplication of a matrix with 6x6 cell.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
M.Bilal
am 1 Feb. 2020
Kommentiert: M.Bilal
am 3 Feb. 2020
Here, i want to multply matrix with 6x6 cell array, but the error occurs. How can i solve this?
Here
S_m is 6x6 cell array
I2 is 1x6 matrix, I2=[1 1 1 0 0 0]
In order to multiply both, following code is used:
(error included)
S_dg = cellfun(@times,S_m,num2cell(I2),'uni',false); %to multiply matrix I2(1x6) with cell array 6x6
Error using cellfun
All of the input arguments must be of the same
size and shape.
Previous inputs had size 6 in dimension 1.
Input #3 has size 1
0 Kommentare
Akzeptierte Antwort
Stephen23
am 1 Feb. 2020
Use an anonymous function instead:
fun = @(m) m.*I2;
S_dg = cellfun(fun,S_m,'uni',false);
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!