cascading mux blocks syntax help needed

조회 수: 9 (최근 30일)
Kelsey Thompson
Kelsey Thompson 2017년 4월 20일
댓글: Kelsey Thompson 2017년 4월 20일
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]].

채택된 답변

Sebastian Castro
Sebastian Castro 2017년 4월 20일
편집: Sebastian Castro 2017년 4월 20일
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
  댓글 수: 3
Sebastian Castro
Sebastian Castro 2017년 4월 20일
Did you try that, and did it work?
I think the corrected statement would be u(4)*u(3), since -- as I mentioned -- muxes don't nest but rather stack things into one big vector.
Again, there's no harm in trying this out yourself and seeing what works :)
Kelsey Thompson
Kelsey Thompson 2017년 4월 20일
Your suggestion worked. Thanks for the help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by