How can I multiply each bus element with a constant?
3 views (last 30 days)
Show older comments
I created a Bus with more than 1000 Signals. Is there a way to multiply each element (or parts of the bus) with a constant without using a busselector?
0 Comments
Answers (1)
Mark McBroom
on 19 Mar 2017
This can be done easily with a ML Function block. Code in ML Fcn Block:
y = u; elemNames = fieldnames(u); for i=1:numel(elemNames) y.(elemNames{i}) = u.(elemNames{i})*2 + i; end
See atttached example.
See Also
Categories
Find more on Sources in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!