MATLAB Answers

hi i need to do heatmap and have some problem with histcounts functions and the map

1 view (last 30 days)
Litalo
Litalo on 8 Sep 2020
Commented: KSSV on 8 Sep 2020
ok
so thats the problem -
i have vector d (size 5,000)
and i have matrix mat_X which show positions - every column show x positions over time for corresponding d in the vector (my original mat_X is 5000*5000 matrix)
so i want to built accumulated heat map of position along x (col from mat_X) for different d value (1position from the vector for the first col, 2 for 2nd and so on)
so for doing so, i need first to use histcounts for every col (since my data is not so small )
so i did this loop
bins=50;
Accumulated_Prob=zeros(bins,length(d));
for i=1:length(d)
[P,cc] = histcounts(mat_X(:,i),bins,'normalization','probability');
Accumulated_Prob=Accumulated_Prob+P';
end
heatmap(Accumulated_Prob)
title('Accumulated Heat Map of RF x position, Vf at x=-1')
xlabel('d')
ylabel('x')
but... i get only black graph...
i would appreciate help !

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 8 Sep 2020
Edited: KSSV on 8 Sep 2020
You have to save the values into a matrix in loop, which you are not doing.
bins=50;
Accumulated_Prob=zeros(bins,length(d));
for i=1:length(d)
[P,cc] = histcounts(mat_X(:,i),bins,'normalization','probability');
Accumulated_Prob(:,i) = P';
end
heatmap(Accumulated_Prob)
title('Accumulated Heat Map of RF x position, Vf at x=-1')
xlabel('d')
ylabel('x')

  4 Comments

Show 1 older comment

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by