How to calculate the mean from cell when each cell is a different double.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
mohsen moslemin
el 22 de Ag. de 2016
Comentada: mohsen moslemin
el 22 de Ag. de 2016
Hi Im reading excel files and storing them into data{k} so my data is 1x34 cell and each cell is a double, with variable column number and fixed row 13, now i want to calculate mean of 34 files for column and row 1 and do the same for the rest.I tried cell2mat but this doesnt work as i have different values for columns.
folder='E:\Engine image\E100 cycles\All Excel Files';
filetype='*.xlsx';
f=fullfile(folder,filetype);
d=dir(f);
for k=1:numel(d);
data{k}=xlsread(fullfile(folder,d(k).name));
end
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 22 de Ag. de 2016
Editada: Andrei Bobrov
el 22 de Ag. de 2016
EDIT
m = numel(data);
[ii,~]= cellfun(@size,data);
a = nan(max(ii),size(data{1},2),m);
for jj = 1:m
a(1:ii(jj),:,jj) = data{jj};
end
out = nanmean(a,3);
Más respuestas (1)
Azzi Abdelmalek
el 22 de Ag. de 2016
cellfun(@(x) mean(x,2),data,'un',0)
5 comentarios
Azzi Abdelmalek
el 22 de Ag. de 2016
Editada: Azzi Abdelmalek
el 22 de Ag. de 2016
This is not clear, to make your problem clear, you can post a short example, and also post the expected result, you haven't specified clearly what mean we have to calculate. You said also, that your matrices are not the same sizes
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!