フィルターのクリア

How can I change an initial/constant value in a simulink model

69 ビュー (過去 30 日間)
Alfried
Alfried 2014 年 1 月 6 日
編集済み: Vincent Nicolazzo 2019 年 3 月 6 日
Hey together,
I am receiving two signal from an external source into simulink. depending on the value of each signal I need to change some constant variable in my model, but I dont know how to do it.
Another thing is, that I have to rewrite a constant variable in a user defined matlab-function, but I dont know how to do it as well.
I hope, you can help me out.
greetings
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 6 日
Can you provide more details?
Alfried
Alfried 2014 年 1 月 7 日
thanks for your answer. here's a picture of my current model:
i know that the input is missing but thats not the point here. i think i solved one of my problems already.
so my other problem still is, that the variable firstRun is initialized to 1, then an image is stored in the variable origImg. but i dont know how to change the variable firstRun to the value 0 after this is done, so that in the next simulationstep the else-case will do its job.

サインインしてコメントする。

採用された回答

Alfried
Alfried 2014 年 1 月 9 日
ok I'm updating my question, because it's still current. Heres is my current simulink model:
my problems are still the same. so I'm going to explain again, what I want to do actually. The variable initRun is initialized to 1. so the else-case will be activated and an 176x177 image is stored to the data origImg.
And here is my first Problem: after an image is stored to origImg the variable initRun shall be set to the value 0, so that in the next simulation step the if-case will be activated.
My second problem: the variable origImg must be initialized correctly. But I dont find a way to initialize a 176x144 matrix in the block "Data Store Memory" (see picture):

その他の回答 (1 件)

Vincent Nicolazzo
Vincent Nicolazzo 2019 年 3 月 6 日
編集済み: Vincent Nicolazzo 2019 年 3 月 6 日
Check out this link. It's not the best method but it worked for me. I would run my simullation and change the value of the constant in the command window.
Be sure to change the constant's sample time to anything but inf

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by