how to refactor variable/parameters names used in a whole simulink project

i have a big project (over 20 000 variables) in these variables some are used throughout the entire project in referenced models in certain blocks etc. the variables are mostly enums. i want to change 'variableA' to 'variableB' how would i do so?
the only thing i got is to change each and every one manualy by hand using a CTRL+F on the main model.
thanks for the help!

Risposte (1)

Based on my understanding of the question, you have a Simulink model with more than 20000 variables included in various “subsystem” blocks and “referenced subsystem” blocks and would like to rename certain variable and all its instances.
I was able to come up with a method to achieve that, follow the steps given below:
  1. On Simulink’s toolstrip, go to MODELING > Model Explorer.
  2. In the Model Hierarchy pane, right-click on the Simulink file’s name and select “Find Referenced Variables” option.
  3. Find the variable you want to rename in the list of all the variables that appear, right-click on that variable, select “Rename All” option and then click “OK”.
  4. Enter the new name for the variable in “New name” section and click “OK”.
  5. Press Ctrl+D on the keyboard to compile the model and verify the changes made.
For more information about editing and managing Workspace Variables and Model Explorer, refer to the following links:
Hope this help you!

5 Commenti

Thanks that look promising, I will try it out and reach back!
After trying it out, I would say it is not usable as it been about 20 minutes loading all objects (more than 100 000). When searching for a specific variable to change in the top right search bar, it just cant and event crashes sometimes. Am I missing some options somewhere that makes the explorer it still updating ( i have Update diagram set to no)? To be clear, I am not able to reach step 3 because I cannot find the variables I want to change in the list of found objects.
This method also brings me concerns, lets says i have These models
When I change the value of my enum, the value inside my bus dataType doesnt follow
*not trying to acheive anything here this is just so the code compile and that the variables are "used".
To share a more accurate solution, I would require the Simulink model. This will allow me to replicate the issue of the "updating the model" and "referenced variables not loading" on my end and identify the root cause more effectively.
Unfortunately i Cannot shared this code but we could programaticly fill a sldd or a model with 100 000-150 000 tmpvariable

Accedi per commentare.

Categorie

Scopri di più su Create Large-Scale Model Components in Centro assistenza e File Exchange

Prodotti

Release

R2022b

Richiesto:

il 6 Ago 2024

Commentato:

il 8 Ago 2024

Community Treasure Hunt

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

Start Hunting!

Translated by