sum of two cell arrays with different dimensions
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mori
am 13 Jul. 2016
Beantwortet: Andrei Bobrov
am 13 Jul. 2016
I have 2 cells, A, includes 1*6 cell and each cell has 290 doubles. B, includes 1*11 cell and each cell has 1*6 cell and each cell has 290 doubles.
how I sum A+B by repeating A for each 11 cells ?!
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 13 Jul. 2016
A={rand(4,1) rand(4,1)} % Example
B={{rand(4,1) rand(4,1)},{rand(4,1) rand(4,1)},{rand(4,1) rand(4,1)}}
C=cellfun(@(x) cellfun(@(z1,z2) z1+z2,A,x,'un',0),B,'un',0)
0 Kommentare
Weitere Antworten (1)
Andrei Bobrov
am 13 Jul. 2016
m = numel(A);
n = numel(B);
C = cell(size(B));
for jj = 1:n
for ii = 1:m
C{jj}{ii} = A{ii} + B{jj}{ii};
end
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices 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!