Count how many element are inside each cell af a cell array on the basis of an array
7 次查看(过去 30 天)
显示 更早的评论
Hi given a cell array
V={{[1,1,1,1;25,45,70,90],[2,2,2,2;78,112,146,180],[3,3,3,3;93,127,161,195],[4,4;70,100],[6;85],[9,9;85,110]},{[],[2,2,2,2;73,107,141,175],[3,3,3,3;83,117,151,185],[4,4,4,4;65,85,105,125],[6;85],[9,9,9;80,105,130]}};
and an array
SP= [1 2 3 4 6 9]
I want to create a matrix M that has as many rows as the cell in V (in this case 2)
CONSIDERING THE FIRST CELL:
Inside the row of M how want to count how many elements are present in each cell of the same type, and that cannot exceed a value of 80 (<80) referring to the second raw of each cell.
considering element 1 in V{1,1} that occupies V{1,1}{1,1}
In this case the number of 1 that do not exceed 80 is 3.
take the element 2
is just 1.
Doing the same for all the elements and cells i ontain M:
M= [3 1 0 1 0 0; 0 1 0 1 0 1]
May someone help me with the code?
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!