Search code examples
matlabsignalssimulinkmodelingdimensions

Change dimension from signals in matlab simulink


I have tried to change the dimension of output signals via the reshape block in Simulink. Unfortunately without success, does anyone have an idea how I can still do this? I need a 1, dimensional value for further calculations.

The errors:

Error in port widths or dimensions. 'Output Port 5' of 'XXX/Tire and suspension/Front/Suspension/dimSuspension/Bus Selector' is a [1x4] matrix.

Error in port widths or dimensions. Invalid dimension has been specified for 'Input Port 1' of 'XXX/Tire and suspension/Front/Suspension/dimSuspension/Reshape'.Reshape config

Thanks a lot

Reshape config

Simulink Signal overview


Solution

  • From Simulink Docs: https://de.mathworks.com/help/simulink/slref/selector.html

    The Selector block generates as output selected or reordered elements of an input vector, matrix, or multidimensional signal. Based on the value you enter for the Number of input dimensions parameter, a table of indexing settings is displayed. Each row of the table corresponds to one of the input dimensions in Number of input dimensions.

    For each dimension, you define the elements of the signal to work with. Specify a vector signal as a 1-D signal and a matrix signal as a 2-D signal. When you configure the Selector block for multidimensional signal operations, the block icon changes.

    For example, assume a 6-D signal with a one-based index mode. The table of the Selector block dialog changes to include one row for each dimension. If you define dimensions as shown in the next table, the output is Y = U(1:end,2:6,[1 3 5],Idx4:Idx4+7,Idx5,Idx6(1):Idx6(2)), where Idx4, Idx5, and Idx6 are the index ports for dimensions 4, 5, and 6.