# problem in dealing Cell and array

1 Ansicht (letzte 30 Tage)
Vinay Killamsetty am 20 Okt. 2019
I have a cell name 'k'
Each cell of 'k' contains two dimensional array with row size 'r' and column size 'q' (r*q)
I want to make a matrix whose size is (row, column)=(k*q) in which each element is a sum of elemnts of the column vector of each array in cell 'k'
I have attached the picture related to this problem for clear understanding of the problem
I there any simple solution for doing this using cellfun command
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Stephan am 20 Okt. 2019
% produce some data to play with
r = 3;
q = 4;
k(1:5) = {rand(r,q)}; % size of k = 1 x 5
% This should do what you expect:
k = reshape(cell2mat(cellfun(@sum,k,'UniformOutput',false)),size(k,2),[])
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Vinay Killamsetty am 22 Okt. 2019
Thanq very much

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

R2019b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by