MATLAB: Cascading mux blocks syntax help needed

function blockmux blocksimulink

In simulink I have a mux block leading into the first signal of a second mux block which leads into a function block. In the function block, what is the syntax to reference one of the signals from the first mux block? Currently I have u[1[3]].

Best Answer

Two issues here:
  • If you look at the example syntax right above where you typed, you need to use MATLAB-style indexing with parentheses. So you want u(1) instead of u[1], for instance.
  • Simulink muxes do not implement "nesting"; instead, they stack all signals vertically. In your example, the output of the second Mux should simply be a 4-element array.
By the way, if all you want to do with that Fcn block is extract individual elements of a multidimensional signal, you can also use the Selector block.
Sebastian