matlab - Converting simulink blocks to code for a GUI? -
i create gui in matlab has 2 sliders can used adjust value , b. know can gui open simulink , have simulink , packet information using udp shown in following image:
however, prefer able convert these simulink blocks code in gui slider. more specifically, interested in coding packet output block gui button can send information. know how this?
as long know "path" block, can set / parameters using set_param
, get_param
. in case, first constant block has path 'rtpacketio/constant'
- is, system name followed /
, followed name of block.
to find out parameters available block, can do,
>> get_param('rtpacketio/constant', 'dialogparameters') ans = value: [1x1 struct] <<< 1 need change vectorparams1d: [1x1 struct] samplingmode: [1x1 struct] outmin: [1x1 struct] outmax: [1x1 struct] outdatatypestr: [1x1 struct] lockscale: [1x1 struct] sampletime: [1x1 struct] frameperiod: [1x1 struct]
note values of these parameters not struct
s - struct array returned dialogparameters
parameter represents information parameters; when set or block's parameter must string (because it's going edit
control). in code want set parameter, then, can following:
set_param('rtpacketio/constant', 'value', num2str(myconstantvalue));
you may wish replace num2str
more accurate equivalent, if require high precision.
Comments
Post a Comment