how to enable continuous-time matlab functions to initialized persistent variables

Hi, I have problem to start the simulation model in 2018b. The model was simulated flawless in matlab 2016b, however problem occur in 2018b
" MATLAB Function uses constructs that are invalid when the block specifies or inherits a continuous sample time. Invalid constructs include the use of persistent or global variables, calls to exported functions or using coder.extrinstic. Suggested Actions Set sample rate of this block to inherit the fastest discrete rate in the model. Fix Open the properties dialog of this block to set the sample time manually."
I've searched in other links, who suffered the same problem such as Migrating from Matlab 2015b to 2017b error - MATLAB Answers - MATLAB Central (mathworks.com), but the problem didn't solved yet. I found the problem starts at version 2017B. Then, I found on matlab Enable continuous-time MATLAB functions to write to initialized persistent variables - MATLAB & Simulink (mathworks.com), which I'm sure that this one is the solution (they mentioned it, that continuous time for persistents variables was turn off by default starting 2017b).
However, the problem still can't be solved, because on "Simulation Target" and "advanced parameter" as it mentioned, I still didn't find the option"Enable continuous-time MATLAB functions to write to initialized persistent variables"
Can anyone help this one? Thank you

4 Comments

Hi,
for me the same, i figured out that the setting is not available within 2020a. I was checking the options in the matlab help of my installed version.
My workaround: memory-block instead of persistent variables, not that nice, but working for my problem.
@Phillip thank you for your response. Yes, that's the same idea that already came into my mind. I have read some release note from 2017a till 2018b actually, especially in 2017b, to find out what changes have been made actually, so that it's not possible to use persistent variable with continuous sample time. However, I couldn't find it either.
Anyway, what about using delay block instead of memory block?
Thanks for your comment.
hello, I'm Raj, I would like to mention that I have tried using Delay block as I'm trying to simulate an OFDM system. This also doesn't give a continous time. Please let us Know if your problem is fixed. It would help me as well.
Thank you
@rajmouli jujjavarapu Have you tried to use memory block? or you can try also Rate Transition Block.

Sign in to comment.

Answers (0)

Categories

Products

Release

R2018b

Asked:

on 7 Jul 2021

Commented:

on 24 Jul 2021

Community Treasure Hunt

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

Start Hunting!