Finding the locations of non-similar value cells
2 ビュー (過去 30 日間)
古いコメントを表示
I have varying in size numeric cells within a cell array that contain random numbers betweem -10 and 200. I have another cell array with the same dimmensions as the first, only with different random values.
Lets call the 2 cell arrays “CA” and “CB”
I want to determine the cell array locations where there is a -10 in an "X" location in cell array CA, but not in cell array CB so that I may manipulate those specific values.
0 件のコメント
回答 (1 件)
the cyclist
2019 年 5 月 1 日
編集済み: the cyclist
2019 年 5 月 1 日
I'm not certain I understand exactly what you want, but this is my best guess:
% Define input arrays
CA = {[-10 2],[6;6]};
CB = {[17 2],[6;6]};
% Logical index to locations where CA includes a value of -10, but CB does not
idx = cellfun(@(x)any(x(:)==-10),CA) & not(cellfun(@(x)any(x(:)==-10),CB));
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!