Indexing cell array similar to excell

1 visualizzazione (ultimi 30 giorni)
Shinobido
Shinobido il 23 Lug 2019
Commentato: Shinobido il 24 Lug 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 Commenti
Peter Jarosi
Peter Jarosi il 23 Lug 2019
Could you upload your data and code, please!
Shinobido
Shinobido il 23 Lug 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

Accedi per commentare.

Risposta accettata

Jan
Jan il 23 Lug 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 Commenti
Shinobido
Shinobido il 24 Lug 2019
Works just good! Thanks!
Shinobido
Shinobido il 24 Lug 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)];

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Import from MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by