Delete the line that are repeated
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, I made a code that compares two strings and what I want to do is to delete from the old strings the lines that are in the new one.
tf = strcmp(seq1,seq2);
disp('Comparing')
disp(seq1);
disp(seq2);
disp(tf);
if tf == 1
disp('Ha entrado al if')
M_conjunt = [M_conjunt,seq1];
end
I want to delete the ones that are in M_conjunt from both seq1 and seq2. I do not know how to do it. Thank youu!!!!
3 件のコメント
Jan
2021 年 7 月 19 日
It is not clear, what the inputs seq1 and seq2 are: CHAR vectors, Strings, cell strings, string arrays?
The useful functions are: ismember, setdiff, union, unique.
回答 (1 件)
Matt J
2021 年 7 月 19 日
what I want to do is to delete from the old strings the lines that are in the new one.
For example,
oldstring=["dog"; "fish"; "cat";"zebra"]
newstring=["fish"; "zebra"]
difference=setdiff(oldstring,newstring)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!