Simulink Realtime - is it possible to change parameter dimensions?
2 views (last 30 days)
Show older comments
Sandra on 9 Jun 2022
Answered: Dimitri MANKOV on 10 Jun 2022
I have a realtime model that is using Look-up Tables, when the model is loaded on the target (SpeedGoat) I want to change the Breakpoints & Table using setparam command from a Matlab App.
This works OK if I use a new parameter of the same size, but if I want to reduce/extend the number of points, I get an error:
Error using slrealtime.Target/throwErrorWithCause
Cannot set 'miX_pos_vehNotchBP2_km' parameter value on target 'Speedgoat': Actual dimensions are '1 16',
expected dimensions are '1 17'.
I also tried feeding the parameters into the Lookup Table (using 'Input Port' rather than 'Dialog') but get the same error.
So my question is - is there anyway I changing the parameter dimensions when the model is loaded on the target? or do I need to used 'resample' to resize my new parameter?
Dimitri MANKOV on 10 Jun 2022
I don't think this is possible: once the code is generated, the dimensions are fixed as far as I know. But you could indeed use the resample function, or have several lookup tables of different dimentsions in your model, and then switch between them using a Multiport Switch block, for example.
I hope this is helpful!
Find more on Target Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!