How to use use histc in multiple array

i have the following cell array F=
[710x1 double]
[711x1 double]
[711x1 double]
[711x1 double]
[713x1 double]
[714x1 double]
I want to use the element in each array to build a bin with range x=1:0.5:10 using histc and then i want to take the average of the bin of all the six arrays. i know to access the values in the cell array but i have struggling to solve this problem. Any suggestion. Thanks.

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 8 日

0 投票

You can use a for loop

2 件のコメント

gustavo sanchez
gustavo sanchez 2015 年 7 月 9 日
編集済み: Azzi Abdelmalek 2015 年 7 月 9 日
Thanks Azzi i used for loop to create the bin in each cell using
for i=1:length(f)
f(i)=mat2cell(histc(f{i,1},x));
end
and get F=
[17x1 double]
[17x1 double]
[17x1 double]
[17x1 double]
[17x1 double]
[17x1 double]
the problem is still i can't manage to calculate the mean of the bins. I want to average the first row of each bin ,second row of each bin and so on. Finaly i will have a single cell array [17x1 double].
Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 9 日
add this
a=cell2mat(F')
out=mean(a,2)

サインインしてコメントする。

Andrei Bobrov
Andrei Bobrov 2015 年 7 月 9 日
編集済み: Andrei Bobrov 2015 年 7 月 9 日

0 投票

a = cellfun(@(x)histc(x,1:0.5:10),F,'un',0);
out = mean([a{:}],2);

カテゴリ

質問済み:

2015 年 7 月 8 日

コメント済み:

2015 年 7 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by