Histogram of cell array ?

I have a 4-D cell containing a lot of values (from simulation). I wish to plot a histogram representing all those values. How do I do so?

 Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 10 de Ag. de 2011

4 votos

% Ain - 4-D cell array
hist(cell2mat(cellfun(@(x)x(:),Ain(:),'un',0)))

4 comentarios

Jason
Jason el 10 de Ag. de 2011
Hi, may I ask, if there are empty arrays within the 4-D cell, is the outcome still the same?
Jason
Jason el 10 de Ag. de 2011
I am still very much new to 'handles' in MATLAB. I searched Help for both the functions 'cell2mat' and 'cellfun' but still can't quite get what the code does.
Andrei Bobrov
Andrei Bobrov el 10 de Ag. de 2011
yes,
eg:
>> cell2mat([{};{[2;3;4]}])
ans =
2
3
4
Jason
Jason el 10 de Ag. de 2011
Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 10 de Ag. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by