MATLAB: Does isfield return unexpected results for a FINTS object

Financial Time Series Toolbox

Creating a FINTS object and then using the isfield method to check for the existence of the field 'times' returns unexpected results. The following code illustrates the behavior:
 
data = [1:6]';
dates = [today:today+5]';
tsobjkt = fints(dates, data);
fieldnames(tsobjkt)
ans =
'desc'
'freq'
'dates'
'series1'
isfield(tsobjkt,'times')
ans =
1

Best Answer

This is a known limitation of MATLAB. 
A workaround is to check the output of the "fieldnames" function for the string 'times' using "strcmp" instead:
 
data = [1:6]';
dates = [today:today+5]';
tsobjkt = fints(dates, data);
fieldnames(tsobjkt)
ans =
'desc'
'freq'
'dates'
'series1'
isfield(tsobjkt,'times')
ans =
1
any(strcmp(fieldnames(tsobjkt),'times'))
ans =
0