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

1 次查看(过去 30 天)
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