Getting the nonzero mean of each cell element
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a cell dot_value (100x100 in size), and I wanted to find the mean of each cell (but only considering the nonzero elements). Here is my attempt:
for r1 = 1:l
for r2 = 1:w
mean_value(r1,r2) = mean(nonzeros(dot_value{r1,r2}));
end
end
I don't know why it returns an error "Conversion to cell from double is not possible."
1 个评论
James Tursa
2018-4-5
编辑:James Tursa
2018-4-5
What is the class of the dot_value elements? I.e.,
class(dot_value{1,1})
And have you pre-allocated mean_value to something?
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!