Why bar function is so slow?

2 views (last 30 days)
Oliver Lestrange
Oliver Lestrange on 20 Aug 2020
Edited: Oliver Lestrange on 20 Aug 2020
Hi,
I am using the following code.
function densityButton_Callback(hObject, eventdata, handles)
% hObject handle to densityButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
i = handles.map.img(:,:,1)==255 & handles.map.img(:,:,2)==255 & ...
handles.map.img(:,:,3)==255;
Prx = handles.maxPrxArray;%(i);
minPower = round(handles.minPrx);
maxPower = round(handles.maxPrx);
% Eixo dos xx - Histograma
eixoXX = minPower:maxPower;
size = length(Prx);
% Histograma
pdfGra = 100*hist(Prx, eixoXX)/size;
figure
axis([(minPower-10) (maxPower+10) 0 100])
bar(eixoXX,pdfGra);
xlabel('Potência [dBm]')
ylabel('Probabilidade [%]')
title('Função de Densidade de Probabilidade');
grid on
cdfGra = cumsum(pdfGra);
figure
axis([(minPower-10) (maxPower+10) 0 100])
bar(eixoXX,cdfGra);
xlabel('Potência [dBm]')
ylabel('Probabilidade [%]')
title('Função de Distribuição de Probabilidade Cumulativa');
grid on
This code is extremely slow. I made debug and I find out that is the bar function that make it so slow.
Is there something that I can do to make it faster?
I am using the version R2016a.

Answers (0)

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!