MATLAB: Express data in percentage

%MATLABpercentage

Hi everyone.
I need some help with smth that looks easy but I can't solve it.
I need to convert and express the y axis (LWP) in %
This is the code:
decsending_LWP 32x16x60 double
ascending_LWP 32x16x60 double
edges 1×45 double
h1 1×44 double
h2 1×44 double
lat 16×1 double
lon 32×1 double
time 32x16x60 int64
edges = [-0.1:0.025:1];
h1 = histcounts(ascending_LWP,edges);
h2 = histcounts(descending_LWP,edges);
figure
bar(edges(1:end-1),[h1; h2]')
grid on
xlabel('LWP bin');
ylabel('LWP');
Many thanks

Best Answer

[h1, edges1] = histcounts(ascending_LWP, 'Normalization', 'probability');
[h2, edges1] = histcounts(descending_LWP, 'Normalization', 'probability');
From MATLAB doc : specify 'Normalization' as 'probability' to normalize the bin counts so that sum(N) is 1. That is, each bin count represents the probability that an observation falls within that bin.