creation of a histogram with RGB values (in .txt file)

7 vues (au cours des 30 derniers jours)
Alberto Acri
Alberto Acri le 12 Avr 2022
Réponse apportée : KSSV le 12 Avr 2022
I would like to obtain the histogram in the figure below with the RGB values present in the .txt file.
In the .txt file.: The first column is Red. The second column is Green. The third column is Blue.
How can I do it?

Réponses (1)

KSSV
KSSV le 12 Avr 2022
data = importdata('filename.txt') ;
h1 = histogram(data(:,1), 10);
h1 = h1.Values ;
h2 = histogram(data(:,2), 10);
h2 = h2.Values ;
h3 = histogram(data(:,3), 10);
h3 = h3.Values ;
clf
figure(1)
set(gca,'color','k')
hold on
bar(1:10, h1,'r')
bar(11:20, h2,'g')
bar(21:30, h3, 'b')

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by