Matthew James
Matthew James

Reputation: 37

Dynamically get n'th element of vector in Simulink

I have a vector [-1 1 -4 9 7] stored in a constants block. I also have signal which contains a scalar which is determined from other parts of my Simulink code. Let's call that scalar, 'n'. How do I extract the n'th element of my vector? Example:

Example

Upvotes: 0

Views: 3065

Answers (1)

Ander Biguri
Ander Biguri

Reputation: 35525

The easy solution I can think of is making a custom block and just adding a Multiport Switch to it.

Upvotes: 2

Related Questions