how to remove rows from structure array on matlab

조회 수: 9 (최근 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 CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by