How to remove similar element in cell?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
laith Farhan
am 3 Aug. 2018
Kommentiert: laith Farhan
am 4 Aug. 2018
Dear Sir,
Is that possible to remove the similar element in each cell based on previous cell. for example:
z={[],[],282,[195,249,282],[195,249,282],[195,249,282],[195,249,282],[103,195,249,282],[103,195,249,282] [104,1,50,103,195,249,282]}
My I get the expected results below:? results = {[], [], 282, [195,249], [195,249], [195,249], [195,249], [103],[], [104,1,50],}
Thanks in advance and sorry for bothering you.
2 Kommentare
Albert Fan
am 3 Aug. 2018
Why there are four [195,249] in your expected result? Aren't you trying to remove all duplicate numbers?
Akzeptierte Antwort
Fangjun Jiang
am 3 Aug. 2018
Bearbeitet: Fangjun Jiang
am 3 Aug. 2018
setdiff(), going through a loop
results=z;
for k=2:length(z)
results{k}=setdiff(z{k},z{k-1});
end
celldisp(results);
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!