필터 지우기
필터 지우기

How can i extract all element except 'SP' 'NS''GX' and need to put it as a colum with numeric columns?

조회 수: 1 (최근 30일)
I have 100 data set like follows, 'GX' is always in the end, but 'SP', 'NS' positions can change other data sets. I would be thankful, if someone can suggest a coding for this..
'SP'
'NS'
'GS'
'GS'
'GS'
'GS'
'GS'
'GS'
'GS'
'GS'
'GS'
'GS'
'NS'
'GS'
'SP'
'GS'
'GS'
'GS'
'GS'
'NS'
'GS'
'GS'
'GA'
'GA'
'GA'
'NS'
'GS'
'GS'
'GS'
'GS'
'GS'
'NS'
'GS'
'GS'
'GS'
'GS'
'GS'
'NS'
'GS'
'GS'
'GS'
'GS'
'GS'
'NS'
'GS'
'GS'
'GS'
'GS'
'GS'
'NS'
'GS'
'GS'
'GS'
'GX'

답변 (1개)

Arnab Sen
Arnab Sen 2016년 2월 24일
Hi Nadeera,
I am assuming that you have a set of cell arrays each of which represents the data set and you would like to extract the data which does not match some specific string. Please find below a sample script demonstrating this:
%Assume that cell array A represent the data set.
>>B={'SP','NS','GX'};
>>C={};
>>len=length(A);
>>for i=1:len
if( isempty( find(cellfun('length',regexp(B,A{i})) == 1)))
C{end+1}=A{i}
end
end
The above script will extract all the elements in 'A' which are not present in 'B' and store them in another cell array 'C'.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by