omit same element inside cell
Mostra commenti meno recenti
A={[1,2,3,4],[4,2,3],[1,2,5,6,78,9],[1,2,3,4],[1,2,5,6,78,9],[4,2,3],[5,6,7]};
c=cellfun(@(x) unique(x),A,'UniformOutput',false);
I want to omit same array inside cell
result should be
A={[1,2,3,4],[4,2,3],[1,2,5,6,78,9],[5,6,7]};
2 Commenti
madhan ravi
il 3 Apr 2019
?? [4,2,3] & [5,6,7] have the same size there is something wrong in your logic or your explanation
NA
il 3 Apr 2019
Risposta accettata
Più risposte (1)
Jos (10584)
il 3 Apr 2019
You can convert the elements of each cell to a char array and apply unique on that cell array of chars.
A = {[1,2,3,4],[4,2,3],[1,2,5,6,78,9],[1,2,3,4],[1,2,5,6,78,9],[4,2,3],[5,6,7]};
% engine
[~,ix] = unique(cellfun(@(x) num2str(x), A ,'un', 0), 'stable') ;
B = A(ix) % as requested
1 Commento
NA
il 3 Apr 2019
Categorie
Scopri di più su Image Arithmetic in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!