strcmp and rows of dataset table
이전 댓글 표시
i have a text dataset with 4 columns and n rows : cl1 cl2 cl3 cl4 i want to know how can i use strcmp() to show which rows are with the same CL2 and CL3 (no CL2=CL3)for example ,according to the dataset below i want to show row1 and row4 , becouse they have same cl2 and cl3,
cl1 cl2 cl3 cl4
---------------------------
a b c d
d j h n
s b v y
q b c g
and as i said dataset has "n" rows so some rows have same CL2-Cl3 and... i want to make domains, for example Domain1={some rows with same CL2-CL3} Domain2={some rows with another same CL2-Cl3} , ...
pleasecheck code below and give me idea what should i do? how to use strcmp() in this case? and how to show the target rows?
fid = fopen('Input2.txt','r')
data = textscan(fid,'%s %s %s %s')
fclose(fid)
indices = strcmp(data{2}{1},data{2})&&(data{1})
sum(indices)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Managing Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!