Simulink Realtime - is it possible to change parameter dimensions?

3 次查看(过去 30 天)
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?

回答(1 个)

Dimitri MANKOV
Dimitri MANKOV 2022-6-10
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!

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by