MATLAB: How to extract the max items in struct 3d3d modelingfacesstructsurfacevertices Hello there, I have a struct of faces and vertices, how to extract the item that has the maximum faces and vertices? Best Answer When you say "max", did you mean "max number of elements" or "max value within a vector"? Did you want something like this?for j = 1:10 %Just creating a test case structure A(j,1) = struct('faces', zeros(1, randi(1000)), ... 'vertices', zeros(1, randi(1000)));endFaces = cellfun('length', {A.faces});Vertices = cellfun('length', {A.vertices});MaxIdx = find(Faces == max(Faces) & Vertices == max(Vertices)); Related SolutionsMATLAB: Find the maximum Area of a binary image stats = regionprops(YourBinaryImage, 'Area');biggest_circle = max( [stats.Area] ); MATLAB: How to save vertices array from 1×1 struct separately in M-file Create a new variable containing just the vertices and save that new variable. Related QuestionOptimise for loop in using cell arrayIs polyarea command related to fill comand
Best Answer