delete some matrix in cell with condition
1 view (last 30 days)
Show older comments
Let's say I have 2 cells, & these 2 cells have relationship(cell_A and cell_B always have same dimension; mean: they have same number of matrix):
cell_A : 1x2 cell class
cell_A={[matrix_A1] [matrix_A2]};%contain 2 matrices
cell_A={[5x3 double] [2x3 double] }={[1 1 1;2 2 2;3 3 3;4 4 4;5 5 5] [11 11 11;0 0 0]};
cell_B : 1x2 cell class
cell_B={[matrix_B1] [matrix_B2]};%contain 2 matrices
cell_B={[4x1 double] [3x1 double] }={[100;6;22;33] [1;5;9]};
Now, i want to use the value in each matrices of cell_B to check corresponding matrix in cell_A.
If any value(vector) in matrix of cell_B is larger than predefined value(10). So, corresponding matrix in cell_A will be maintained.
Example: matrix_B1 have four value: 100;6;22;33. There are exist at least one value larger than 10. So, matrix_A1 will be maintained
matrix_B1 have three value: 1;5;9. There are exist NO value larger than 10. So, matrix_A2 will be deleted
result_cell={[5x3 double]}={[1 1 1;2 2 2;3 3 3;4 4 4;5 5 5]};%after delete some matrix in cell_A
0 Comments
Accepted Answer
Walter Roberson
on 5 Jun 2019
result_cell = A(cellfun(@(Bent) any(Bent(:)>Threshold), B));
0 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!