how can i solve this probleme :??? Attempted to access degree(100); index out of bounds because numel(degree)=1
Show older comments
hello i have this msg :
??? Attempted to access degree(100); index out of bounds because numel(degree)=1.
Error in ==> untitled>pushbutton4_Callback at 397
degree(i)=degree(i)+1;% CALCULE LEs nombre de neighbord( DEGRE) DES NOEUDS
REDONDANTS
with this code :
degree=[];
if isfield(handles,'net')
for i = 1:numel(handles.net(1,:))
degree(i)=0;
for j = 1:numel(handles.net(1,:))
X1 = handles.net(2,i);
Y1 = handles.net(3,i);
X2 = handles.net(2,j);
Y2 = handles.net(3,j);
xSide = abs(X2-X1);
ySide = abs(Y2-Y1);
d = sqrt(xSide^2+ySide^2);% distance euclidienne
DD(:,i)=d;
%disp(DD);
%RESORTIR LES NOEUD REDONDANTS
if (d<=2*(handles.r))&&(i~=j)
degree(i)=degree(i)+1;% CALCULE LEs nombre de neighbord( DEGRE) DES NOEUDS REDONDANTS
disp(degree(i));
plot([X1,X2],[Y1,Y2],'o','LineWidth',0.1);
% ((X1,Y1),(X2,Y2))= mat_redondant;
%disp(mat_redondant);
hold on;
for i = 1:numel(handles.net(1,:))
for j = 1:numel(handles.net(1,:))
if (d<=2*(handles.r))&&(i~=j)
if (max(degree))&&(min(handles.d_sink))
plot([X1,X2],[Y1,Y2],'o','LineWidth',0.1);
end
end
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!