how demux the Matrix 3*3 in simulink in matlab
Error:Invalid setting for dimensions of input port of 'inv/Demux'. The Demux cannot be used to split matrices
Error:Error in port widths or dimensions. 'Output Port 1' of 'inv/Constant2' is a [3x3] matrix.

댓글 수: 3

mohammad
mohammad 2024년 2월 5일
Does anyone know this?
Avni Agrawal
Avni Agrawal 2024년 2월 5일
Hi, can you share the code file?
mohammad
mohammad 2024년 2월 5일
matlab2023b

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

 채택된 답변

Avni Agrawal
Avni Agrawal 2024년 2월 5일

2 개 추천

Hi Mohammad,
I understand that you are trying to demux 3*3 matrix in Simulink. You cannot directly pass a 2D vector (matrix) as input to a Demultiplexer (Demux) block in Simulink. The Demux block is designed to work with 1D vectors, where it can separate the vector into its individual elements.
There are two ways to make this work:
Method 1: Using Reshape block
Method 2: Use Selector blocks to extract elements from a matrix. You will need to configure each Selector block to extract the appropriate element.
Here's how you can set up the Selector blocks to demux a 3x3 matrix:
1. Drag and drop 3 Selector blocks onto your Simulink model from the Simulink Library Browser under the Simulink > Signal Routing category.
2. Connect the input matrix to the input of each Selector block.
3.. For each Selector block, double-click to open its parameters and set the following:
- Number of input dimensions: Set this to `2` for a 2D matrix.
- Index mode: `One-based`
- Index Option: Select `Index vector (dialog)` for both dimensions.
- Index Vector (dialog): 1
- Index Vector (dialog): [1 2 3]
Repeat this process for each element, changing the indices accordingly.
This will create 3 selector blocks having 1D vector with each row data in selectors respectively.
You can now connect them via mux and then pass it to Demux.
I hope this helps.

댓글 수: 4

mohammad
mohammad 2024년 2월 5일
편집: mohammad 2024년 2월 5일
thanks
mohammad
mohammad 2024년 2월 5일
If you have the method 2 simulation file, please send it, thank you
Avni Agrawal
Avni Agrawal 2024년 2월 5일
mohammad
mohammad 2024년 2월 5일
thanks

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

추가 답변 (1개)

Selena Mastrodonato
Selena Mastrodonato 2024년 2월 5일

1 개 추천

You can use the Selector block for matrix. Here the documentation.

카테고리

도움말 센터File Exchange에서 Matrix Operations에 대해 자세히 알아보기

질문:

2024년 2월 5일

댓글:

2024년 2월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by