How to concatenate multiple signals into one signal?

13 views (last 30 days)
I have multiple signals which are In-ports to a subsystem with different datatypes.I am using State flow to develop a function where I have to use these in-ports and compare with some constants or true/false for boolean.
For e.g: Lets say 3 signals namely Signal_x [bool], Signal_y[bool], signal_z[bool], I want to incorporate these signals into one signal called as Signal_A and use signal_A in State Flow instead of above 3 signals.
More detail: If there are 2 states state1 & state2 and the system transits from state 1 to state 2 if all the three signals are true, like given below.
[(Signal_x == true) && (Signal_y == true) && (signal_z == true)] then transit from State 1 to state 2.
But instead of using all 3 signals in state flow I want to use only one signals "signal_A" and say the system to transit from state1 to state2.
[(signal_A == true)] then transit from state1 to state2. Signal_A should check the status of all the 3 signals.
Can anyone help me out how this can be done. I have tried using merge block but it did not work and the error was "external signals from root level imports cannot be merged with internal block output signals"

Answers (1)

Mark Schwab
Mark Schwab on 25 Jan 2018
You may want to look into the Mux block or the Matrix Concatenate block. The Mux block combines all of the input vectors to a single vector and can be used in combination with the Demux to retrieve the original signals. With the mux, you do not have control over the dimension of concatenation. With the Matrix Concatenate block you do have control over the dimension of concatenation but retrieving the original signal is not as straightforward. I have included the documentation for each below:

Categories

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