how to remove rows from structure array on matlab

11 ビュー (過去 30 日間)
HYUNGJUN PARK
HYUNGJUN PARK 2020 年 7 月 23 日
回答済み: KSSV 2020 年 7 月 23 日
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
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
KSSV 2020 年 7 月 23 日
A = rand(300,1) ;
idx = randperm(300,112) ;
B = A(idx) ;
val = ismember(A,B) ;
iwant = A(~val) ;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by