strcmp and rows of dataset table
Show older comments
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)
Accepted Answer
More Answers (0)
Categories
Find more on Managing Data 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!