Initialize MATLAB-Function

4 views (last 30 days)
I've read in the previous questions, that initializing a MATLAB-Function in Simulink is done like:
persistent j;
if isempty(j)
j = 1;
And I have done so. Then I use the value j.
The problem is, as I want to run the simulink model, I get the following error:
Any ideas how to solve this problem?

Accepted Answer

Ameer Hamza
Ameer Hamza on 19 Nov 2020
This is not really an error. It just tells that you need to change the sampling rate of this block from continuous to discrete. Just click the "Fix" button on the first box under "Suggested actions" and the error will be fixed.

More Answers (0)


Find more on General Applications in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!