Indexing cell array similar to excell

1 view (last 30 days)
Shinobido
Shinobido on 23 Jul 2019
Commented: Shinobido on 24 Jul 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 Comments
Peter Jarosi
Peter Jarosi on 23 Jul 2019
Could you upload your data and code, please!
Shinobido
Shinobido on 23 Jul 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

Sign in to comment.

Accepted Answer

Jan
Jan on 23 Jul 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 Comments
Shinobido
Shinobido on 24 Jul 2019
Works just good! Thanks!
Shinobido
Shinobido on 24 Jul 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)];

Sign in to comment.

More Answers (0)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!