How can I write a Mask parameter to the workspace in Simulink?
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Rafael Cordero
il 21 Giu 2020
Commentato: Rafael Cordero
il 23 Giu 2020
Hello world!
I have a masked subsystem with two parameters fc_lo and fc_hi. They define the corner frequencies of a Bandpass FIR filter inside the subsystem (specified in the dialog box of the Bandpass FIR filter block). However, once run, I get an error saying how these variables are not defined in the Matlab workspace.
Is there a way to write these Mask parameters to the matlab workspace so that the bandpass filter block will recognize them?
(I already looked at previous questions such as https://uk.mathworks.com/matlabcentral/answers/179344-how-can-i-mask-a-bandpass-filter-block-from-the-dsp-system-toolbox-r2014b?s_tid=answers_rc1-1_p1_MLT - but when I implemented their solutions the model ran incredibly slow).
Thanks
Rafael
2 Commenti
Ashish Azad
il 22 Giu 2020
Hi Rafael,
You have to initialize the value of parameter used by the blocks inside subsystem using fc_lo and fc_hi.
Could you please share your screenshot of subsystem block diagram, so I can assist you further.
Risposta accettata
Fangjun Jiang
il 22 Giu 2020
The masked parameters seem to mismatch internal variables. The easiest way is to change the #1 and #2 parameter name in the mask dialog from "ecg_fc_lo" to "fc_lo", from "ecg_fc_hi" to "fc_hi". But then, you also need to add the masked parameter for "fs".
Look in document to learn about mask.
11 Commenti
Fangjun Jiang
il 23 Giu 2020
Sorry for the extra route. You could utilize your original mask. In the original model you posted, in the mask of the subsystem, in the initilization tab, add the two lines below
assignin('base','fc_lo',fc_lo);
assignin('base','fc_hi',fc_hi);
You should have fc_lo and fc_hi defined in the base workspace initially to avoid error when starting simulation right after openning the model. The value doesn't matter. When Simulation runs, the value got updated.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interactive Model Editing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!