How to compare the content of 2 cells and get the content from cell1 column1?
2 ビュー (過去 30 日間)
古いコメントを表示
hello guys, i have 2 cells and i want to compare cell1 (of size 172*1) column1 with cell2 (of size 30644*2) column2. If they are equal i would like to get their content from cell2 column1.
Note that the rows of cell1 column1 may occur multiple times in cell2 column2.
inputs:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190865/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190866/image.png)
Expected outputs:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190867/image.png)
2 件のコメント
Nikhil Negi
2018 年 5 月 28 日
Hello, are the contents of cell 2 column 2 just repetitions of the contents of cell 1 column 1??
回答 (2 件)
Nikhil Negi
2018 年 5 月 29 日
Hello chocho,
you can use temp=ismember(cell1,cell2(:,2)) ans=all(temp); if ans=1 then cell1 is a subset of cell2 column 2(your required condition) and if ans=0 then your condition is not satisfied
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!