Find() Command Error incorrect output

1 回表示 (過去 30 日間)
Articat
Articat 2020 年 2 月 28 日
回答済み: Articat 2020 年 2 月 28 日
I have the following Code:
[row_inst_5(:,:,image), col_inst_5(:,:,image)] = find(BB_inst(:,:,image));
The input to the "find()" command is a 137x145 Matrix.
When I run the code it outputs a 138x1 matrix for both "row_inst_5" and "col_inst_5" which is incorrect based off the "find()" guidlines in the Matlab explanaion on how to use the "find()" command. This is an issue because when I run this in a loop of images from 1-93, 1-8 will be the correct size (137x1) while 9 will be the incorrect size (138x1). This is an issue because my loop then errors.
How can I fix this issue?
Thanks for your help.
  1 件のコメント
Articat
Articat 2020 年 2 月 28 日
Is there a way I can do this through logical indexing? BB_inst is jet a matrix filled with zeros and ones and I just want to find the location of matrix elements that are greater than zero..

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

採用された回答

Articat
Articat 2020 年 2 月 28 日
[row_inst_5(:,:,image), col_inst_5(:,:,image)] = find(BB_inst(:,:,image), 137)
lol

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by