how to remove rows from structure array on matlab
8 次查看(过去 30 天)
显示 更早的评论
Let's say there are 2 structure arrays, A and B.
A is a 300x1 size structure, and B (112x1) is a subset of A, which means B is randomly selected from A.
I want to remove those rows from A so that the size of A becomes 118x1.
How can I deal with this problem??
1 个评论
James Tursa
2020-7-23
How did you randomly select B? Do you have indexes or a logical vector? The obvious thing to do would be to take the complement of that selection from A.
采纳的回答
KSSV
2020-7-23
A = rand(300,1) ;
idx = randperm(300,112) ;
B = A(idx) ;
val = ismember(A,B) ;
iwant = A(~val) ;
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!