find a string element in a structure matrix
www.mathworks.com › matlabcentral › answersMar 13, 2012 · For that the following will find the index of the first occurrence, index = find (strcmp ( {structname.field}, 'string')==1) Geoff on 13 Mar 2012 1 Link Direct comparison operators (==, etc) don't work with strings. You need to use strcmp or strcmpi (which ignores case). Because that function doesn't work on an array, you need to map it:
Field of structure array - MATLAB getfield
www.mathworks.com › help › matlabJul 19, 2018 · When you use the getfield function, you can access a field of the structure returned by a function without using a temporary variable to hold that structure. value = getfield (what ( 'C:\Temp' ), 'mlx') value = 1×1 cell array {'testFunc2.mlx'} You also can access a field using dot notation. value = S.mlx value = 1×1 cell array {'testFunc2.mlx'}