How to find all rows other than a particular row?

85 ビュー (過去 30 日間)
lucksBi
lucksBi 2018 年 1 月 5 日
コメント済み: lucksBi 2018 年 1 月 5 日
Hey all
how can i find all rows other than a particular row in a matrix?
matrix = [1,1,1,0,0;0,1,1,1,0;0,0,1,0,1]
result = {[2;3];[1;3];[1;2]}
e.g. if we are considering row 1 then all other rows in matrix will be shown in result except row 1
  3 件のコメント
lucksBi
lucksBi 2018 年 1 月 5 日
criteria is that if diagonal element e.g. for row1 its (1,1) is 1 then take other rows except from 1. Same will for applied for 2,2 and 3,3.
Cell array is good option but I Can get results in double array as well.
lucksBi
lucksBi 2018 年 1 月 5 日
I got answer for this one. Thanks alot for your time @Birdman

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

採用された回答

KSSV
KSSV 2018 年 1 月 5 日
Let's say you have N rows.....and you have selected M'th row, then use Setdiff to get what you want.
N = 12 ; % 12 rows
M = 3; % selected 3rd row
iwant = setdiff(1:N,M)
  1 件のコメント
lucksBi
lucksBi 2018 年 1 月 5 日
Yea Thank You.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by