How can you import a constant (1x1) matrix into Simulink, from Matlab workspace?

For a heat transfer model, I am using several constants in multiple places.
I want to be able to create those constants in matlab, import and use them in simulink and then if I change the value of a constant in matlab, it changes it throughout the model.
Ex: mass flow rate: mdot = 25... it is used in about 5 places. If I change it to mdot = 15, it changes in all the mdot constant blocks in the model.
Thanks ahead of time! Laurie

 Accepted Answer

Have you tried a constant block from Simulink/Sources?

1 Comment

Ok, you're right. Thank you. All I had to do was input the name of the variable in my constant block.
I had tried this previously and it did not work.. must have been a glitch. Thanks again.

Sign in to comment.

More Answers (1)

Thanks for the quick reply. Yes I have tried and read the documentation.
What I don't understand is, if I went into the constant block parameters and wrote "mdot" as the constant value, how could I tell simulink to get that value from the matlab workspace, where there exists a 1x1 matrix called "mdot"?
The simulink Thermal House demo does this, but I don't know how it was set up.
Thanks again.

Categories

Find more on Modeling 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!