MESHFACENUMBER Returns the number of faces in this mesh. NF = meshFaceNumber(V, F) NF = meshFaceNumber(V, E, F) NF = meshFaceNumber(MESH) Returns the number of faces in the given mesh. As the face array may be represented either as numeric array or as cell array of indices, this function is a convenient way to get the number of faces independanlty of the mesh representation. Example [v f] = createCube; meshFaceNumber(v, f) ans = 6 See also meshes3d
0001 function nFaces = meshFaceNumber(varargin) 0002 %MESHFACENUMBER Returns the number of faces in this mesh. 0003 % 0004 % NF = meshFaceNumber(V, F) 0005 % NF = meshFaceNumber(V, E, F) 0006 % NF = meshFaceNumber(MESH) 0007 % Returns the number of faces in the given mesh. As the face array may be 0008 % represented either as numeric array or as cell array of indices, this 0009 % function is a convenient way to get the number of faces independanlty 0010 % of the mesh representation. 0011 % 0012 % Example 0013 % [v f] = createCube; 0014 % meshFaceNumber(v, f) 0015 % ans = 0016 % 6 0017 % 0018 % See also 0019 % meshes3d 0020 % 0021 0022 % ------ 0023 % Author: David Legland 0024 % e-mail: david.legland@grignon.inra.fr 0025 % Created: 2013-08-22, using Matlab 7.9.0.529 (R2009b) 0026 % Copyright 2013 INRA - Cepia Software Platform. 0027 0028 [vertices, faces] = parseMeshData(varargin{:}); %#ok<ASGLU> 0029 0030 if iscell(faces) 0031 nFaces = length(faces); 0032 else 0033 nFaces = size(faces, 1); 0034 end