# How to change constant block automatically and run automatically

6 visualizzazioni (ultimi 30 giorni)
omsuraj gutti il 16 Set 2022
Commentato: Paul il 21 Set 2022
hello all
I want to change the firing angle constant block with multiple values and run simulink model automatically
how can i make it
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (3)

Sam Chak il 16 Set 2022
Write a mathematical function for the MATLAB Function block that describes behavior of the firing angle:
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

omsuraj gutti il 17 Set 2022
Actually my question you not understood
i want continuous change of values and on changing every value i need to save scope results in excel or pdf or word
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Paul il 17 Set 2022
Modificato: Paul il 17 Set 2022
Is your question, "How do I run the simulation for multiple values of firing angle and save the results of each simulation?"
If so, I don't know if there's a way to programatically retrieve the data from the scope block after a simulation runs. Maybe someone else does. What you can do is route the signals to be saved to To Workspace blocks. Then one simple way would be
firing_angle = {'30' '35' '40'};
for ii = 1:3
set_param('yourmodel','yourmodel/firingangle',firing_ange{ii});
out(ii) = sim('yourmodel');
end
The data from each run will be in out(1), out(2), and out(3).
After running the loop, the simulation will be left with a value of 40 as the firing angle, not whatever it was to be begin with.
Or, change the parameter of the firingangle block to a variable name, like firingangle. Then
for firingangle = [30 35 40]
out(ii) = sim('yourmodel');
end
More generally, see Run Multiple Simulations and/or Optimize, Estimate, and Sweep Parameters and the links therefrom for alternative approaches.
##### 2 CommentiMostra NessunoNascondi Nessuno
omsuraj gutti il 20 Set 2022
As per that the value not changing it is struck at first value only
Paul il 21 Set 2022
Sorry, I don't understand this comment, and maybe I don't understand the question. Is my intepretation of your question, as I wrote in the very first line of my Answer, correct?

Accedi per commentare.

### Categorie

Scopri di più su Programmatic Model Editing in Help Center e File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by