Azzera filtri
Azzera filtri

How can I make a histogram from many text files?

1 visualizzazione (ultimi 30 giorni)
Naoki Ishibashi
Naoki Ishibashi il 11 Set 2016
Modificato: michio il 11 Set 2016
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.

Risposte (1)

michio
michio il 11 Set 2016
Modificato: michio il 11 Set 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!

Translated by