Finding matching strings from a table and making a new table

1 visualización (últimos 30 días)
SChow
SChow el 18 de Feb. de 2020
Comentada: Stephen23 el 18 de Feb. de 2020
I have a huge table of size 18792010x57 (57) are the number of columns.
As an example say the table (T) that looks like:
'A' 'B' 'C' 'D'......'BC'
'AFG' 'NCD' 22 1..... 2
'CAN' 'NCD' 36 7......4
'AFG' 'HER' 21 3......3
'BER' 'NCD' 32 1......5
'CAN' 'HER' 31 1......3
I want to make a separtate table (T_1) just for AFG like:
'A' 'B' 'C' 'D'......'BC'
'AFG' 'NCD' 22 1..... 2
'AFG' 'HER' 21 3......3
I am using readtable function to read the table and the used the below line but it returns an error --> 'Undefined operator '==' for input arguments of type 'cell'
T_1 = T(T.A == 'AFG')
  1 comentario
Stephen23
Stephen23 el 18 de Feb. de 2020
This is not a good sign:
T_1
Putting numbers into variable names indicates that you are doing something wrong.
Splitting up into multiple tables is unlikely to be required, it is usually easier to process the data in one table:

Iniciar sesión para comentar.

Respuesta aceptada

Bhaskar R
Bhaskar R el 18 de Feb. de 2020
T_1 = T(strcmp(T.A, 'AFG'), :);

Más respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by