how to use find to cell cell indexing
1 回表示 (過去 30 日間)
古いコメントを表示
why does this not work ?
find(grnd_truth_cell{:,1} == 6)
I want to find all of grnd_truth_cell whose 1st column at every row == 6 but matlab tell me Error using == Too many input arguments.
2 件のコメント
Image Analyst
2016 年 12 月 10 日
If you just type this on the command line
grnd_truth_cell{:,1}
what does it report to the command window? Show us.
採用された回答
dpb
2016 年 12 月 10 日
Because as your command line shows,
grnd_truth_cell{:,1}
is a comma-separated list. Enclose it in the [] to make an array that find can operate over--
find([grnd_truth_cell{:,1}]==6)
その他の回答 (1 件)
Image Analyst
2016 年 12 月 10 日
編集済み: Image Analyst
2016 年 12 月 10 日
Maybe you can assign it to a column vector first
col1 = grnd_truth_cell{:,1};
whos col1
rowsThatEqual6 = find(col1 == 6); % Braces.
How does that work? Maybe you need to use cell2mat():
col1 = cell2mat(grnd_truth_cell(:, 1)); % Parentheses
If that doesn't work, attach grnd_truth_cell in a .mat file so I can try some things.
save('grnd_truth_cell.mat', 'grnd_truth_cell');
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!