MATLAB: How to delete duplicate values in a cell array of characters

charactersdeleteduplicate

hi! I have this cell array of charachter:
a={'1';'1';'1';'1';'1';'3';'3';'3';'3';'3';'3';'4';'4';'4';'4'};
and I want to trasform it in this:
a={'1';'';'';'';'';'3';'';'';'';'';'';'4';'';'';''};
can you help me? thanks

Best Answer

a={'1';'1';'1';'1';'1';'3';'3';'3';'3';'3';'3';'4';'4';'4';'4'};
[~,c,~]=unique(a);
tmp=true(size(a));
tmp(c)=false;
[a{tmp}] = deal('')