Use the isfield
function to check if a field exists in a structure in Matlab. isfield(structure, field)
accepts a structure and a string as input arguments and returns a logical indicating if the field exists in the structure or not. Here is an example:
main.m192 chars7 lines
This will output: "field1 exists in the structure".
gistlibby LogSnag