Binary data in Logical associated with coordinates

1 回表示 (過去 30 日間)
jgillis16
jgillis16 2016 年 1 月 11 日
コメント済み: jgillis16 2016 年 1 月 11 日
I need to export only the 1's in a logical array into a text file. But, I need to export the coordinates associated with the 1's into a text array, not the 1's themselves. Would this be possible?

採用された回答

Stephen23
Stephen23 2016 年 1 月 11 日
編集済み: Stephen23 2016 年 1 月 11 日
>> X = randi(2,5)-1;
>> [R,C] = find(X);
>> csvwrite('temp2.txt',[R,C])
produces this file (with the coordinates of the ones):
2,1
5,1
3,2
5,2
3,3
5,3
1,4
2,4
5,4
1,5
2,5
  1 件のコメント
jgillis16
jgillis16 2016 年 1 月 11 日
Exactly what I was looking for! Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by