Trying to filter timeseries data by logical index on time within matlab function block but it tells me property Time not recognized as valid
I’m trying to load a year-long timeseries from a .mat file and then select a single day’s data from that file within a matlab function block. The loaded timeseries data is one input to the block (tsinput) and a number indicating the day of interest in MMDD format is the other input (daynum). My function block code is:
function tsoutput = fcn(tsinput, daynum)
%find the doy for the daystr input
datestr = strcat(daynum,’2023′);
coder.extrinsic(‘datetime’);
datedt = datetime(datestr, ‘InputFormat’, ‘MMddyyyy’);
coder.extrinsic(‘day’);
datedoy = day(datedt,’dayofyear’);
mask = tsinput.Time>datedoy & tsinput.Time<datedoy+1;
% Create a new timeseries with only those samples
tsoutput = getsamples(tsinput, mask);
But when I try running my simulink code, which is just a from file block and constant number block with the matlab function block, I get these errors:
Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
Component:MATLAB Function | Category:Coder error
Property ‘Time’ is not recognized as valid.
Function ‘MATLAB Function’ (#36.261.273), line 10, column 8:
"tsinput.Time"
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Errors occurred during parsing of ‘testdataload/MATLAB Function’.
Component:MATLAB Function | Category:Coder error
Simulink is unable to determine sizes and/or types of the outputs for block ‘testdataload/MATLAB Function’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:MATLAB Function | Category:Coder error
Simulink is unable to determine sizes and/or types of the outputs for block ‘testdataload/MATLAB Function’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:Simulink | Category:Model error
Error in port widths or dimensions. ‘Output Port 1’ of ‘testdataload/MATLAB Function/tsinput’ is a one dimensional vector with 1 elements.
Component:Simulink | Category:Model errorI’m trying to load a year-long timeseries from a .mat file and then select a single day’s data from that file within a matlab function block. The loaded timeseries data is one input to the block (tsinput) and a number indicating the day of interest in MMDD format is the other input (daynum). My function block code is:
function tsoutput = fcn(tsinput, daynum)
%find the doy for the daystr input
datestr = strcat(daynum,’2023′);
coder.extrinsic(‘datetime’);
datedt = datetime(datestr, ‘InputFormat’, ‘MMddyyyy’);
coder.extrinsic(‘day’);
datedoy = day(datedt,’dayofyear’);
mask = tsinput.Time>datedoy & tsinput.Time<datedoy+1;
% Create a new timeseries with only those samples
tsoutput = getsamples(tsinput, mask);
But when I try running my simulink code, which is just a from file block and constant number block with the matlab function block, I get these errors:
Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
Component:MATLAB Function | Category:Coder error
Property ‘Time’ is not recognized as valid.
Function ‘MATLAB Function’ (#36.261.273), line 10, column 8:
"tsinput.Time"
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Errors occurred during parsing of ‘testdataload/MATLAB Function’.
Component:MATLAB Function | Category:Coder error
Simulink is unable to determine sizes and/or types of the outputs for block ‘testdataload/MATLAB Function’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:MATLAB Function | Category:Coder error
Simulink is unable to determine sizes and/or types of the outputs for block ‘testdataload/MATLAB Function’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:Simulink | Category:Model error
Error in port widths or dimensions. ‘Output Port 1’ of ‘testdataload/MATLAB Function/tsinput’ is a one dimensional vector with 1 elements.
Component:Simulink | Category:Model error I’m trying to load a year-long timeseries from a .mat file and then select a single day’s data from that file within a matlab function block. The loaded timeseries data is one input to the block (tsinput) and a number indicating the day of interest in MMDD format is the other input (daynum). My function block code is:
function tsoutput = fcn(tsinput, daynum)
%find the doy for the daystr input
datestr = strcat(daynum,’2023′);
coder.extrinsic(‘datetime’);
datedt = datetime(datestr, ‘InputFormat’, ‘MMddyyyy’);
coder.extrinsic(‘day’);
datedoy = day(datedt,’dayofyear’);
mask = tsinput.Time>datedoy & tsinput.Time<datedoy+1;
% Create a new timeseries with only those samples
tsoutput = getsamples(tsinput, mask);
But when I try running my simulink code, which is just a from file block and constant number block with the matlab function block, I get these errors:
Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
Component:MATLAB Function | Category:Coder error
Property ‘Time’ is not recognized as valid.
Function ‘MATLAB Function’ (#36.261.273), line 10, column 8:
"tsinput.Time"
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Errors occurred during parsing of ‘testdataload/MATLAB Function’.
Component:MATLAB Function | Category:Coder error
Simulink is unable to determine sizes and/or types of the outputs for block ‘testdataload/MATLAB Function’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:MATLAB Function | Category:Coder error
Simulink is unable to determine sizes and/or types of the outputs for block ‘testdataload/MATLAB Function’ due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component:Simulink | Category:Model error
Error in port widths or dimensions. ‘Output Port 1’ of ‘testdataload/MATLAB Function/tsinput’ is a one dimensional vector with 1 elements.
Component:Simulink | Category:Model error simulink, matlab function block, timeseries, logical index MATLAB Answers — New Questions









