Compare elements of cell array
이전 댓글 표시
HI I have a 2D array like this:

and a cell array:

I want to search elements of cell array in 1st column of 2D array. Like 2nd row of cell array has 4 and 3, it is present in 1st column of 2D array, it should display both rows (and all other elements as zero).
Thanks in advance.
댓글 수: 5
the cyclist
2017년 4월 2일
What specifically do you want the output to look like for this example?
Also, it is much easier for us if you paste in code that generates the matrices, or upload a file. If you only upload an image, we have to code that ourselves.
the cyclist
2017년 4월 2일
I think I understand, but I have two more clarifying questions:
Do you want the output to be a 6x1 cell array (for this example), in which each cell contains a numeric array?
For the cell for the 2nd row, should output be the full 7x7 array (with some rows zeroed out), or just the 2x7 array of the corresponding rows that are indicated?
Similarly, for the 1st row, do you want to have an empty array, or a 7x7 array of all zeros?
Tha saliem
2017년 4월 2일
@Tha saliem: I notice that you are clearly using my code from your earlier question:
Is there a reason why you do not accept my answer... even though you are using my answer?
Also it would be much easier if you actually told us what you are trying to achieve, rather than trying to solve these small tasks. Then we could help you to develop a solution for your main task, rather then waste time trying to figure out solutions (that you do not accept) to every small task:
Tha saliem
2017년 4월 2일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!