Simulink Mux parameters

Hi,
I trying to use the value of Mux block output(2 in --> 1 out) in a .m file(my program). I´ve try 'get_param' with parameter 'Value' without success. What the right parameter to read the value in my program. I´m expecting that the value is a vector with 2 elements.Right ?
Thanks Eric

2 Kommentare

Fangjun Jiang
Fangjun Jiang am 30 Aug. 2011
What do you mean by "use the value of Mux block output"? Mux block is for signal routing for the most part. Are you trying to get the value of the signal at the outport of the Mux block from your M-script while the simulation is running?
Eric Zanghi
Eric Zanghi am 1 Sep. 2011
Yes! Exactly, I want to use the vector 'u' in M-script while the simulating is running.
I have many muxes, so, the idea is get this value from each block and update the correspondent variable in M-script.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 1 Sep. 2011

0 Stimmen

It is not particularly related to the Mux block. You are looking for a way to get the dynamic signal data from a Simulink block while the simulation is running. See this post http://www.mathworks.com/matlabcentral/answers/14061-get-value-from-simulink-model-to-matlab-gui-while-simulink-is-running for the method. There are several steps involved. See link from TMW.
I would recommend that you not to get the signal data from the Mux block. Instead, you should try to get the signal data from its source, such as a Gain block, or a Sum block where the signal is created. Mux block in many cases is used for signal routing.

6 Kommentare

Eric Zanghi
Eric Zanghi am 1 Sep. 2011
I´ll use one function for many blocks. I need to know wich block was updated to match with respective variable.I´ll use one variable for each block, so, How can I carrie the block name(path) into the function declared as listener ?
Fangjun Jiang
Fangjun Jiang am 1 Sep. 2011
Take a look at the example in the last link. The callback function contains at least two input arguments. All your event listener will be this one function. You will need to do things differently according to the variable 'block'.
function plot_adapt_coefs(block, eventData)
Eric Zanghi
Eric Zanghi am 1 Sep. 2011
I have the message for any block (even the Gain block):
"Gain block does not have a parameter named 'RuntimeObject'"
Is 'RuntimeObjects' a new parameter ? My Matlab is old(Version 6.1 - 2001)
Fangjun Jiang
Fangjun Jiang am 1 Sep. 2011
I am not sure. What is the release number, like R2007b, R2006b, R14, R13?
Eric Zanghi
Eric Zanghi am 2 Sep. 2011
Release 12.1.
Fangjun Jiang
Fangjun Jiang am 2 Sep. 2011
OMG! I believe R12 doesn't have that!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Eric Zanghi
Eric Zanghi am 3 Sep. 2011

0 Stimmen

The best solution, that attend old versions of ML to, is include S-Function pointing to a Function that you can manipulate the S-Function block DATA (Outputs) and carrie extra variables as parameters. Ex: S-Function block 'Extra' parameters = gcb --> Carrie the block path to inside of the function.
Thanks for all answers and comments that I received ! Eric

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by