필터 지우기
필터 지우기

remove a struct field that its element value is less than specific 50

조회 수: 3 (최근 30일)
sana3 sal
sana3 sal 2018년 10월 4일
댓글: Stephen23 2018년 10월 4일
Hi, I have 4x1 struct with 2 fields as shown:
i want to delete the one that has less faces and vertices for example here field number 4 i have tried this:
Faces = cellfun('length', {CClower.faces});
Vertices = cellfun('length', {CClower.vertices});
MinIdx = find(Faces <= 50);
but now how to select indexes that not equal to MinIdx that i extracted?
  댓글 수: 3
sana3 sal
sana3 sal 2018년 10월 4일
i need to remove the element that is smaller than 50 whatever is its location.
Stephen23
Stephen23 2018년 10월 4일
"i need to remove the element that is smaller than 50 whatever is its location."
That is what my answer does.

댓글을 달려면 로그인하십시오.

답변 (1개)

Stephen23
Stephen23 2018년 10월 4일
편집: Stephen23 2018년 10월 4일
If you want to remove elements of the structure use logical indexing:
Faces = cellfun('length', {CClower.faces});
CClower(Faces<50) = []

카테고리

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