Why bar function is so slow?

1 次查看(过去 30 天)
Oliver Lestrange
Oliver Lestrange 2020-8-20
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.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by