How can I run only a selected case of a switch-case structure in SImulink and not all the others?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm running a model in Simulink with 5 different input signals (e.g., step, sine, chirp, custom, impulse). I created a multi-port switch block to choose which input I want to run (and I have a switch-case structure in my script to load parameters of each one of these cases). The problem is that during execution, Simulink will show me an error because it couldn't evaluate a parameter that is on a different case (i.e., it will force me to enter all the input parameters regardless of which case I'm running). Here is the error I get: [Error evaluating parameter 'f0' in 'Nonlinear3_MyCase_Switch/Subsystem/Switch Case Action Subsystem2/Chirp1' Caused by: Undefined function or variable 'f_ini'. Variable 'f_ini' does not exist.] So, as an example, if I'm running the sine input, I should only need amplitude, frequency and phase of the sine, but I get an error because the model needs also the parameters of the step, impulse, chirp, and so on, which are on a different switch case in my script. So what is the point of having a switch case if I need to write an inefficient code with a bunch of parameters I don't need. I also tried a different approach using conditional execution blocks in Simulink, but it also asks me for all the variables of different cases.
0 commentaires
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!