フィルターのクリア

the values of coordinates in matlab

1 回表示 (過去 30 日間)
muhammad ismat
muhammad ismat 2015 年 8 月 16 日
コメント済み: muhammad ismat 2015 年 8 月 16 日
if i have the matrix s= [
0 0.4000 0.5000 0.6000 0.9000
0.4000 0 0.3000 0.4000 0.5000
0.5000 0.3000 0 0.5000 0.8000
0.6000 0.4000 0.5000 0 0.6000
0.9000 0.5000 0.8000 0.6000 0
and coordinates=[1 2; 1 3; 2 4] then i want that the values of previous coordinates equal zero. i.e s(1,2),s(2,1),s(1,3)s(3,1),s(2,4),s(4,2) equal 0 i.e i want this result
0 0 0 0.6000 0.9000
0 0 0.3000 0 0.5000
0 0.3000 0 0.5000 0.8000
0.6000 0 0.5000 0 0.6000
0.9000 0.5000 0.8000 0.6000 0

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 8 月 16 日
idx=[1 2; 1 3; 2 4]
ii1=idx(:,1)
ii2=idx(:,2)
jdx=sub2ind(size(s),[ii1(:);ii2(:)],[ii2(:);ii1(:)])
s(jdx)=0
  1 件のコメント
muhammad ismat
muhammad ismat 2015 年 8 月 16 日
Thank you very much.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCartesian Coordinate System Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by