Apply Cellfun to only first column but keep second
Mostrar comentarios más antiguos
Im starting with a two column cell array that Ive manipulated to clean up the data I have, pulled certain characters out of string text using regexp which created a 1 column array but I could concatenate its matching second column back. Now within this 2 column array the first column that I manipulated has some empty cells. I would liked to get rid of those empty cells in the first column and their correspnding row in the second column but keep both columns within an array.
Ex. I want to get ride of the first two rows since they are empty but keep the others along with their corresponding numbers in column 2.
[] 1
[] 1
'VWVPSSVMVV' 3
'RWAREVLQFA' 1
'ASLQQWVQVA' 4
Respuesta aceptada
Más respuestas (1)
madhan ravi
el 11 de En. de 2019
mycell={[] 1
[] 1
'VWVPSSVMVV' 3
'RWAREVLQFA' 1
'ASLQQWVQVA' 4};
EXPECTED=mycell(all(~cellfun('isempty',mycell),2),:)
Gives:
EXPECTED =
3×2 cell array
{'VWVPSSVMVV'} {[3]}
{'RWAREVLQFA'} {[1]}
{'ASLQQWVQVA'} {[4]}
1 comentario
Jacob Larson
el 11 de En. de 2019
Categorías
Más información sobre Cell Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!