set all the values of row i to zero in two dimensional array.

6 ビュー (過去 30 日間)
chandra Naik
chandra Naik 2020 年 9 月 2 日
コメント済み: chandra Naik 2020 年 9 月 2 日
%Finding Neighbor
Nbr=zeros(n);
R=20;
for i=1:1:n
for j=i+1:1:n
distance=sqrt( (S(i).xd-(S(j).xd) )^2 + (S(i).yd-(S(j).yd) )^2 );
s(i,j)=distance;
s(j,i)=distance;
if distance< R
Nbr(i,j)=1;
Nbr(j,i)=1;
end
end
end
%% follwing gives no of neighbours of each i
for i=1:1:n
count(i)=sum(Nbr(i,:));
end
%%%%QUESTION%%%%%%
%%% How do I set the all the values of a row i to zero in matlab , some thing like this
Nbr(i,:)={0}

採用された回答

Stephen23
Stephen23 2020 年 9 月 2 日
編集済み: Stephen23 2020 年 9 月 2 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by