Cell Array Filtering Not Working
Mostrar comentarios más antiguos
Hello,
I have an issue filtering a cell matrix that is created from a standard array. When I create the cell matrix outright (not converting a standard matrix), my filtering works exactly as intended. For example, when I try to filter a cell matrix created by the following method:
K={1 32 5 6
4 12 6 8
09 3 6 1}
And filter the third column for each row containing a 6 via:
p=K([K{:,3}]==6,:)
I get exactly what I want which are the rows that correspond to the filtered third column of the original K cell matrix. When I create a cell matrix from a standard matrix though and try to filter the same way I get an error. For example, this code:
A=[1 34 2; 6 4 2; 9 1 0]
B={A}
C=B([B{:,3}]==2,:)
Gives the following error which corresponds to the line defining C:
Index exceeds matrix dimensions.
I don't understand what the difference between my first and second filtering methods are. How would I filter the cell matrix B exactly like I filtered K?
Thanks in advance.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Resizing and Reshaping Matrices en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!