The matlab function block in simulink has a "new feature syntax restriction" compared to the matlab general function. If there is another called function, the called function should be placed in a separate m-file in the current working directory or in a directory that matlab recognises.
By the way, the control of writing programs in simulink has many restrictions compared to matlab and is not free and easy to use. For example, the processing of time series in simulink still uses the "timeseries" object, which has not been updated to the new "timetable" object function of the main matlab module in recent years.