how find idx string deleted

3 次查看(过去 30 天)
a={'aa','bb','cc','aa'}
a = 1×4 cell array
{'aa'} {'bb'} {'cc'} {'aa'}
unique(a,'stable')
ans = 1×3 cell array
{'aa'} {'bb'} {'cc'}
%i want to find idx string deleted..( idx=4)

采纳的回答

Fangjun Jiang
Fangjun Jiang 2023-11-29
a={'aa','bb','cc','aa'};
[b,ida,idb]=unique(a,'stable')
b = 1×3 cell array
{'aa'} {'bb'} {'cc'}
ida = 3×1
1 2 3
idb = 4×1
1 2 3 1
setdiff(1:numel(a),ida)
ans = 4

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by