Rename Parameter for Simulink Model

4 views (last 30 days)
Esma Hadu
Esma Hadu on 3 Jun 2019
Commented: Murugan C on 3 Jun 2019
Hi,
i have build a Simulink Model which requires about 200 parameters which are stored in a *.m file like:
"A_mu = 10; % some Parameter
epsilon = 1 % other Parameter" etc.
Now i need to copy the model because i need one "FRONT" and one "REAR" model and the two models require slightly different parameter values (at least partly).
My idea was to rename all the parameter in a way to add a index "front" and "rear", so that i have two *.m-files and can edit the values.
I found the "rename all" button in the model explorer, but so far i think i would have to rename all parameter names manually and, additionally, rename the parameter in the *.m-file.
Is there a way to automatically add that index? Or maybe is there a better way to deal with the parameters (only a few parameters are not equal for front and rear model, but if i have the same name the two models the parameters, i get some errors)
Greetings
  1 Comment
Murugan C
Murugan C on 3 Jun 2019
HI,
Do you want to change parameter name in .M file or Simulink model, as like below
% in .M file
front_A_mx = 10;
rear_A_mx = 12;
front_epsilon = 1
rear_epsilon = 2;
in model
parameter.JPG
could please post your error.

Sign in to comment.

Answers (1)

Esma Hadu
Esma Hadu on 3 Jun 2019
Hi,
i have to change the names both in the m-file and the Simulink model so that i have the suitable names in the base workspace. I am looking for a way to do this automatically, so that i don't have to write manually "A_mu_front =...." and don't have to change every single name in the model explorer by adding "front" and "rear".
I'm working with a co-simulation interface made from vi-grade which generates an internal error if i use both models (with all parameter names the same). Front and rear model alone works fine.
  1 Comment
Murugan C
Murugan C on 3 Jun 2019
Could please attach your model and ,m file. so that i can support.

Sign in to comment.

Categories

Community Treasure Hunt

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

Start Hunting!

Translated by