필터 지우기
필터 지우기

How to decatenate or discatenate (opposite of concatenate) a vector in simulink?

조회 수: 64 (최근 30일)
Hi,
I am building a general block which needs and generates several signals.
The main idea is to connect one block to the next one, concatenating the output signal, but also decatenating the input (one of each per block).
Suppose two arrays, one of inputs (A) and one of outputs (B). So there will be two inputs (Ain, Bin) and two outputs (Aout, Bout), and they will be connected from one block to the next block.
_______ _______ _______
Ain ----| |----| |----| |----··· Aout (inputs vector)
| BLOCK | | BLOCK | | BLOCK |
Bin ----|_______|----|_______|----|_______|----··· Bout (outputs vector)
The signal the block needs will be always the first of A, and the output will be appended at the end of B. Written in code will be like this:
% Outputs (concatenate)
Bout = [B_generated Bin];
% Inputs (decatenate)
A_wanted = Ain(1);
Aout = Ain(2:end);
In Simulink there is the vector concatenate block which does the first part, but how to decatenate/discatenate the inputs? Is there a proper block?
I don't want to use a selector block because in this case I'll have to modify every block I append and change the input port size.
Thanks in advance!

채택된 답변

Dani Tormo
Dani Tormo 2013년 5월 3일
편집: Dani Tormo 2013년 5월 3일
Ok, job done.
I used the submatrix block for the inputs and the concatenate block for the outputs.
Using the submatrix block you can select the first position of the vector to feed the actual cell, and using another one and selecting from position 2 to the last will decatenate/discatenate the vector properly.
It will look like this:
----[submatrix block u(1)]---- (to drive actual block)
Ain ----
----[submatrix block u(2:end)]---- Aout (to the next block)
In the inputs array, you must add one dummy value at the end in order to avoid an error in the last block because the submatrix. Remind to initialize the outputs vector in the first block as well.
Cheers!

추가 답변 (1개)

Guy Rouleau
Guy Rouleau 2013년 5월 3일
Use the Selector block
  댓글 수: 1
Dani Tormo
Dani Tormo 2013년 5월 6일
편집: Dani Tormo 2013년 5월 7일
I don't want to use a Selector block because I don't want to enter each block and change it.
Thanks anyway!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by