Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Can we convert simulink *.mdl file to matlab *.m file

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: Vihang Patil

Date: 29 Mar, 2005 14:31:56

Message: 1 of 8

Hello
I need to know if anyone knows how to convert Simulink *.mdl file to
*.m file
Please advise.
Thanks
Vihang

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: ABC

Date: 30 Mar, 2005 10:18:32

Message: 2 of 8


Hello

Open a .mdl file in a text editor , and you will see whole lot of
oppurtunity to do your task!!



"Vihang Patil" <vihang_patil@yahoo.com> wrote in message
news:ef00791.-1@webx.raydaftYaTP...
> Hello
> I need to know if anyone knows how to convert Simulink *.mdl file to
> *.m file
> Please advise.
> Thanks
> Vihang

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: dhruv

Date: 21 Mar, 2009 05:46:01

Message: 3 of 8

"Vihang Patil" <vihang_patil@yahoo.com> wrote in message <ef00791.-1@webx.raydaftYaTP>...
> Hello
> I need to know if anyone knows how to convert Simulink *.mdl file to
> *.m file
> Please advise.
> Thanks
> Vihang
hi there i am also finding answer to same question if u have got any answer plz reply me ASAP

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: Sprinceana

Date: 11 Jun, 2009 19:24:01

Message: 4 of 8

Go to your mdl file click right select open with and open with a text editor for example notepad.

And then save it to .m extension.

Hope this helps you a little!

There is no dedicated function to make this conversion in matlab as far as I know!

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: Kranthi Krishna

Date: 16 Nov, 2009 15:10:20

Message: 5 of 8

I need to generate an .m file (from an .mdl file) which on execution produces the source .mdl file

containing add_block() and all.
http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/bq3cxmi.html

any ideas ?

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: checker i

Date: 16 Nov, 2009 16:50:19

Message: 6 of 8

"Kranthi Krishna" <kranthi117@gmail.com> wrote in message <hdrq0s$ml0$1@fred.mathworks.com>...
> I need to generate an .m file (from an .mdl file) which on execution produces the source .mdl file
>
> containing add_block() and all.
> http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/bq3cxmi.html
>
> any ideas ?

There is no command that will convert a simulink model into a m-file.
Can you be more clear on your question,
If your question is , Can we create a model from a m-file?
Ans: yes, you definetely can do that.

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: Tim

Date: 15 Mar, 2012 12:00:28

Message: 7 of 8

"Vihang Patil" <vihang_patil@yahoo.com> wrote in message <ef00791.-1@webx.raydaftYaTP>...
> Hello
> I need to know if anyone knows how to convert Simulink *.mdl file to
> *.m file
> Please advise.
> Thanks
> Vihang

Using R2012a, the copy/paste or rename doesn’t work. Syntax for Simulink and Matlab are different. The Matlab editor reports some ) as errors. The “ needs to be converted to ‘ in some cases. Embedded data is also checked for syntax and fails.

Hope there’s another way.

Cheers

Tim

Subject: Can we convert simulink *.mdl file to matlab *.m file

From: Steven_Lord

Date: 15 Mar, 2012 13:30:29

Message: 8 of 8



"Tim " <tim998765@aol.com> wrote in message
news:jjslks$136$1@newscl01ah.mathworks.com...
> "Vihang Patil" <vihang_patil@yahoo.com> wrote in message
> <ef00791.-1@webx.raydaftYaTP>...
>> Hello
>> I need to know if anyone knows how to convert Simulink *.mdl file to
>> *.m file
>> Please advise.
>> Thanks
>> Vihang
>
> Using R2012a, the copy/paste or rename doesnt work. Syntax for Simulink
> and Matlab are different. The Matlab editor reports some ) as errors.
> The needs to be converted to in some cases. Embedded data is also
> checked for syntax and fails.
>
> Hope theres another way.

Why exactly are you trying to convert a Simulink model file into a MATLAB
function file?

If you're trying to simulate the model from within another MATLAB function,
use the SIM function as described in the documentation.

http://www.mathworks.com/help/toolbox/simulink/ug/br8i6q8.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

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.

Contact us