MATLAB: How to find the number of “struct” class in a structure array classstructstructurevariable Hi, Is there a way to determine the number of "struct" names in the structure array? This way I could elimate the previous non-struct variables created. Thanks Ferd Best Answer nnz(cellfun(@isstruct, struct2cell(YourStruct))) Related SolutionsMATLAB: How to rebuild the Table as a 5×1 structured array with “struct” Code ? data1=['Helium','Hydrogen','Oxygen','Chlorine','CarbonDioxide']';data2=[ 'He', 'H2', 'O2', 'Cl2','CO2']';data3=[0.0341,0.244,1.36,6.49,3.59]';data4=[0.0237,0.0266,0.0318,0.052,0.0427]';table=struct('GasName',data1,'GasSymb',data2,'a',data3,'b',data4) MATLAB: Using Set Field for multiple depths You will not be able to do this using setfield() or getfield(), not in any useful way.You should refer to subsref() and subsassgn(). They are a bit clumsy to use, but they can handle the task. Related QuestionFind and replace missing value in a 1*1 struct with 34 fieldsHow to delete field in struct in loop
Best Answer