Is there a 'block' similar to MATLAB's 'persistent' in simulink??

1 visualizzazione (ultimi 30 giorni)
I have a few questions on image processing using simulink and converting this code using 'hdl coder'.
1. How can I use external variables without using the 'from workspace' block? (because 'from workspace' is not support 'hdl coder')
For example, the brightness value of the first frame is saved using 'to workspace'. And in the second frame, I want to process the image using this brightness value.
2. So, I am wondering if there is a block similar to MATLAB's 'persistent' in Simulink.
For example, like a register setting and i will use this register value in next frame.
3. If I use the 'image from file' block, I can send only one image. Is there a way to send multiple images? In the question above, I want to check whether the first brightness value is used or not.
4. I want to send out the brightness value(save the value using 'to workspace') at the end of the first frame. Is there a way to know the end of the frame?
thank you for all and sorry about my english

Risposte (2)

Kiran Kintali
Kiran Kintali il 2 Lug 2020
I am not using any new Simulink features; so you can try to load the model in your version.
Try this to load the model.
>> slprivate('showprefs')
This is a very useful Simulink preferences tip related to loading new models in older version of Simulink that many are not aware of.
If you still cannot access the model or trouble simulating the model, let me know your MATLAB version and I will export the example to your older version.
  1 Commento
Ki Hyeon Jang
Ki Hyeon Jang il 3 Lug 2020
thank you~ it works well. Could I ask one question?
When I run my simulink, I import a script file with initial parameter values(ex. num1).
And then i calculate brightness value and want to change the initial parameter value dynamically.
And i will want to apply to this parameter next frame or another block. Since this reason, i am searching method that change the value in workspace.
but i don't find proper method of this(i think that 'evalin' doesn't seem to be the proper solution)
Is there a way to change the parameter in simulink??
if it is expressed in figure, it is as bellow

Accedi per commentare.


Kiran Kintali
Kiran Kintali il 1 Lug 2020
Attached model shows how to model unit delay, integer delay, tapped delay in MALTAB and corresponding blocks/modeling patterns in Simulink.
  1 Commento
Ki Hyeon Jang
Ki Hyeon Jang il 2 Lug 2020
Modificato: Ki Hyeon Jang il 2 Lug 2020
thank you~ But i could not open. because it's newer version of simulink.
Could you upload it again that the below version can be opened??

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by