Filter löschen
Filter löschen

How can i use 'sum' for a 'cell array'?

90 Ansichten (letzte 30 Tage)
masoud jiryaei
masoud jiryaei am 7 Mai 2019
Kommentiert: masoud jiryaei am 10 Mai 2019
Hello
i have a cell array that i want to sum the coulmns ;
A={ 1x2 double , 1x2 double
1x2 double , 1x2 double
1x2 double , 1x2 double
1x2 double , 1x2 double }

Akzeptierte Antwort

KSSV
KSSV am 7 Mai 2019
A = cell(4,2) ;
for i = 1:4
for j = 1:2
A{i,j} = rand(1,2) ;
end
end
B = cellfun(@sum,A)

Weitere Antworten (1)

madhan ravi
madhan ravi am 7 Mai 2019
sum(cat(1,A{:}),2)

Kategorien

Mehr zu Matrix Indexing 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!

Translated by