Clear Filters
Clear Filters

How can I make a histogram from many text files?

1 view (last 30 days)
I try to make a histogram from many text files; more than 1000 files. In my program, I can load all datas, and I can make histogram from one data, but I have problem in histogram from all data. If I use "hold" command, it are lay over each graphs horizontally, but I want to stuck datas horizontally. Please give me any advices.

Answers (1)

michio
michio on 11 Sep 2016
Edited: michio on 11 Sep 2016
Assuming the situation where the all data would NOT fit in RAM, I'd suggested using histcouns function to get bin counts of all the text files one by one. Then use bar function to the sum of bin counts to create a histogram.
x = randn(10000,1);
[counts,edges] = histcounts(x); % do this for every file and add-up counts values
center = (edges(1:end-1)+edges(2:end))/2;
bar(center,counts,1)

Community Treasure Hunt

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

Start Hunting!