Indexing cell array similar to excell

조회 수: 1 (최근 30일)
Shinobido
Shinobido 2019년 7월 23일
댓글: Shinobido 2019년 7월 24일
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
Peter Jarosi
Peter Jarosi 2019년 7월 23일
Could you upload your data and code, please!
Shinobido
Shinobido 2019년 7월 23일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2019년 7월 23일
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
Shinobido
Shinobido 2019년 7월 24일
Works just good! Thanks!
Shinobido
Shinobido 2019년 7월 24일
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)];

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by