Why bar function is so slow?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!