1
$\begingroup$

I have a list of around 100 matrices, that looks like this

A={{{425060., 2.14235*10^6, 0.49, 0.01, 0.38, 0.620161, 
   20.}, {1.24808*10^6, 1.53025*10^6, 0.04, 0.07, 0.31, 0.320312, 
   20.}, {7.39304*10^6, 1.40204*10^6, 0.83, 0.45, 0.09, 0.94842, 20.} .... {4.27537*10^6, 
 1.62124*10^6, 0.24, 0.28, 0.62, 0.721388, 20.1}, {3.27776*10^6, 
 2.25816*10^6, 0.01, 0.21, 0.72, 0.750067, 20.1}, {3.0814*10^6, 
 1.95624*10^6, 0.02, 0.19, 0.72, 0.744916, 20.1}, {2.42706*10^6, 
 1.25729*10^6, 0.03, 0.17, 0.7, 0.720972, 20.1}, {4.47196*10^6, 
 1.23247*10^6, 0.24, 0.27, 0.57, 0.674833, 20.1}, {1.57132*10^7, 
 1.65019*10^6, 0.76, 0.92, 0.5, 1.29383, 20.1} ...... 

Each matrix has an unknown number of rows. I want to make a frequency histogram, where the frequency is the number of rows in a matrix and the bin value is the last element of each row. So eg: the first matrix has 50 rows, and the last element of each row is 20.0, so the frequency is 50 for the value 20, and so on.

$\endgroup$
5
  • $\begingroup$ Why not Histogram[Last /@ A]? $\endgroup$
    – kglr
    Oct 31, 2014 at 8:04
  • $\begingroup$ I tried that, but it doesn't seem to work for a list of matrices. $\endgroup$
    – HuShu
    Oct 31, 2014 at 18:11
  • $\begingroup$ For a list of matrices Histogram[A[[All, All, -1]]] should work. $\endgroup$
    – kglr
    Oct 31, 2014 at 18:47
  • $\begingroup$ That works! thank you. :) $\endgroup$
    – HuShu
    Oct 31, 2014 at 20:29
  • $\begingroup$ Nilanjan, great... just posted the comment as an answer. $\endgroup$
    – kglr
    Oct 31, 2014 at 20:38

1 Answer 1

2
$\begingroup$

Perhaps

Histogram[A[[All, All, -1]]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.