Simulink change detection from MATLAB
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Mustafa Onat Güney
il 2 Ott 2019
Commentato: Fangjun Jiang
il 2 Ott 2019
My Matlab script generates a stochastic Load Profile data and I have a simulink model that is getting this data from 'From Workspace' block. I will call this block LP.
What I want to do is; when I copy this LP block and create another block manually from Simulink, I want MATLAB to detect this change and run the model for a new stochastic data for the new block.
My question is if it is possible to achieve ? Otherwise I have to transfer whole model from Matlab to Simulink.
Thanks in advance.
Onat
0 Commenti
Risposta accettata
Fangjun Jiang
il 2 Ott 2019
Right click this "From Workspace" block in your model, select "Properties", select the "Callbacks" panel, select the "CopyFcn" in the left column, on the right panel, type in the MATLAB script or function that generates the stochastic data.
2 Commenti
Fangjun Jiang
il 2 Ott 2019
What you need is to use set_param() in the CopyFcn callback to change the variable name in the "From Workspace" block and make sure the new data variable name generated in MATLAB matches it. For example
set_param(gcb,'VariableName','NewData')
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Model, Block, and Port Callbacks 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!