Indexing cell array similar to excell

1 visualización (últimos 30 días)
Shinobido
Shinobido el 23 de Jul. de 2019
Comentada: Shinobido el 24 de Jul. de 2019
Hello,
I have a 177x25 matrix, which has been imported from excel. I am trying to filter it based on the different variables. The one I am struggling with is the following:
I have a 1*177 cell variable, this has 2 different names, 'A 123' and 'B 456'. I want to filter them separately and use each of them to filter the rest of the data. Any help, thanks
  2 comentarios
Peter Jarosi
Peter Jarosi el 23 de Jul. de 2019
Could you upload your data and code, please!
Shinobido
Shinobido el 23 de Jul. de 2019
Hello,
Error_Filt is another variable which is part of teh code
Thanks for replying.
% Error=Target('A 123'); (Errordist_Filt(:)>2.5);
B 567
B 567
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123
A 123

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 23 de Jul. de 2019
Maybe like this:
Data = rand(7, 25); % Example data, actually 177x25
Names = {'A 123', 'A 123', 'B 456', 'A 123', 'B 456', 'B456', 'A 123'};
A123 = strcmp(Names, 'A123');
B456 = ~A123;
Set1 = Data(A123, :)
Set2 = Data(B456, :)
  2 comentarios
Shinobido
Shinobido el 24 de Jul. de 2019
Works just good! Thanks!
Shinobido
Shinobido el 24 de Jul. de 2019
Finally, I am struglling at creating a new column on after filtering the data.
The code that I have is this, but it creates row and not a column. Could you someone help me on this basic answer? Thanks.
% new_column= [1:height(mastertable)];

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB 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