How to concatenate multiple signals into one signal?
조회 수: 13 (최근 30일)
이전 댓글 표시
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"
댓글 수: 0
답변 (1개)
Mark Schwab
2018년 1월 25일
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:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!