Thread Subject: Generating variable simulink code

Subject: Generating variable simulink code

From: William Barnes

Date: 30 Jul, 2007 20:56:57

Message: 1 of 4

I have an m-file that outputs a number of variables that I want to use to build a simulink file. The problem is that the structure of the simulink model is dependent on the parameter values. I'm trying to find a way to use the outputs from the m-file to build the simulink file without coding every possible permutation of simulink models. Does anyone know of a way that I can do this? Also, how can you generate a simulink model from written code rather than the drag and drop library?

Thanks

 

Subject: Generating variable simulink code

From: Bart Roossien

Date: 31 Jul, 2007 05:33:30

Message: 2 of 4

"William Barnes" <justinb53@aol.com> wrote in message <f8ljap$464$1@fred.mathworks.com>...
> I have an m-file that outputs a number of variables that I want to use to build a simulink file. The problem is that the structure of the simulink model is dependent on the parameter values. I'm trying to find a way to use the outputs from the m-file to build the simulink file without coding every possible permutation of simulink models. Does anyone know of a way that I can do this?

Try using configurable subsystems

>Also, how can you generate a simulink model from written code rather than the drag and drop library?

Not. The whole idea of Simulink is that you can design your models visually.

Subject: Generating variable simulink code

From: Riccardo Carrozzo

Date: 1 Aug, 2007 08:51:30

Message: 3 of 4

"Bart Roossien" <broossien@gmail.com> wrote in message <f8mhja$f9h$1@fred.mathworks.com>...
> "William Barnes" <justinb53@aol.com> wrote in message <f8ljap$464$1@fred.mathworks.com>...
> > I have an m-file that outputs a number of variables that I want to use to build a simulink file. The problem is that the structure of the simulink model is dependent on the parameter values. I'm trying to find a way to use the outputs from the m-file to build the simulink file without coding every possible permutation of simulink models. Does anyone know of a way that I can do this?
>
> Try using configurable subsystems
>
> >Also, how can you generate a simulink model from written code rather than the drag and drop library?
>
> Not. The whole idea of Simulink is that you can design your models visually.

Actually, the last sentence is not true.
You can easily open and manipulate an existing model, or assemble a new one, by means of Model Construction Commands like "new_system", "open_system", "add_block", etc.
Bart, have a look at the documentation on those, they should allow you to do pretty much what you need.
HTH
Riccardo

Subject: Generating variable simulink code

From: Bart Roossien

Date: 5 Aug, 2007 11:02:51

Message: 4 of 4

Riccardo,

you are right that you can build and modify Simulink models
from the command line. I actually ment something different
with my last sentece, but because I was in a hurry and
English is not my native language, I expressed in the wrong way.

What I ment is that you can modify models using the command
line, but IMHO, you shouldn't do it. Using drag and drop,
you can modifiy models way faster then using the command line.

If you want to modify (replace) a block in your model to do
a different simulation, configureable subsystems is the way
to go, instead of deleting the old block and placing the new
one on its spot.

One situation where you could make use of these commands is
in a customised model advisor.

Without more information it is hard to tell what the topic
starter exactly wants to do. He says he has certain output
parameters from an m-script to create a simulink model.
Can't you use tuneable parameters in your case?

I can hardly imagine in what kind of case you would get in
such situation as the topic starter describes and I have a
suscpicion that his modelling/simulation approach is
incorrect, although withour more information this is
difficult to say. Instead of trying to create a work around,
I would suggest going back to the drawing board to design a
new modelling approach.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
model construction command Riccardo 1 Aug, 2007 04:55:09
simulink Riccardo 1 Aug, 2007 04:55:09
simulink B. Roossien 31 Jul, 2007 01:35:09
simulink Ned Gulley 30 Jul, 2007 23:42:38
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com