confronting cell with abelians (logic values)
1 回表示 (過去 30 日間)
古いコメントを表示
I have a question about the way to extract some data from a cell based on some "indices" (in this case I want only to get as an output the "1-associated" values, e.g.:
A={'a' 'b' 'c'; 'd' 'e' 'f';'g' 'h' 'i'}
B=eye(3);
...formula to compare the arrays....
C={'a' '0' '0'; '0' 'e' '0';'0' '0' 'i'}
or
C={'a' nan nan; nan 'e' nan;nan nan 'i'}
I really cannot see the way to easily do it. Thanks
0 件のコメント
採用された回答
その他の回答 (1 件)
Ameer Hamza
2020 年 4 月 8 日
[A{~B}] = deal('0');
1 件のコメント
the cyclist
2020 年 4 月 8 日
A simpler version of this idea is
A(~B) = {'0'}
Caution: this solution overwrites A itself, which you may not want.
参考
カテゴリ
Help Center および File Exchange で Data Preprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!