Mostrar comentarios más antiguos
Hi, I am trying to generate a BUS from a Matlab structure to feed in a Simulink block. I am using this function:
FA.cog = 0.374; FA.mass = 2000: Simulink.Bus.createObject(FA);
It creates a BUS called 'slBus1' in the workspace but as I will have to create severals Buses, I want to control this name. Is there any way to set the name before calling the function or to change the name. It want to do this operation in Matlab before using Simulink.
Respuesta aceptada
Más respuestas (1)
AbhimanyuSingh
el 11 de Mayo de 2018
4 votos
You can try following:
FA.cog = 0.374; FA.mass = 2000; TestObject=Simulink.Bus.createObject(FA);
controlName=eval(TestObject.busName); clear -regexp slBus;clear TestObject;
controlName, is the Name you want. For renaming Multiple bus object you have to loop.
1 comentario
Song Xianjun
el 10 de Abr. de 2024
It's worked well,Thanks!
Categorías
Más información sobre Programmatic Model Editing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!