Simulink Realtime - is it possible to change parameter dimensions?

3 views (last 30 days)
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:
>> setparam(tg,'','miX_pos_vehNotchBP2_km',ones(1,16))
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?

Answers (1)

Dimitri MANKOV
Dimitri MANKOV on 10 Jun 2022
Hi Sandra,
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!

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!