Hello,
I have a question regarding the selection of a specific bus signal. The selection is not the same from time to time, thus the "Bus selector"-block can not be used.
What I'm looking for is something that corresponds to the "Selector"-block for vectors where the ability to select an index is possible with the use of scalar (or some index).
I've defined my own bus object as e.g. A = [foo foo1]. A.foo = [10 11]; A.foo1 = [20 21];
During simulation I woluld like to make the selection of both e.g. A.foo(1) or A.foo1(2).
I believe there is a solution to this, since a bus object can be viewed as a data struct, and one can solve it via a matlab-script by e.g. Say that A is indata, and defined as before:
"function out = bus_selector(A)
WantedValue = SelectorVariable.FieldNumber WantedField = find(fieldnames(A),SelectorVariable.FieldName);
Out = A.{WantedField}(WantedValue)"
Thus, how can I make this possible in Simulink?
Any help much appreciated. Thank you
Sincerely, Pär Hammarlund
Best Answer