Generating an m-file from a simulink model for neural networks

조회 수: 4 (최근 30일)
André
André 2011년 3월 3일
댓글: anumukonda sai himaja 2016년 3월 2일
I was wondeing if it is possible to generate an m-file from a simulink model to allow me edit the code using the text editor. The reason that I would like to do this is generate an m-file of a neural network and it was suggested to me to generate a simulink model and from that generate the m-file however there does not appear to be any straightforward method of doing this. If anyone knows a way of generating an m-file of a neural network in the toolbox that would be great as well, I know that when making a network using the GUIs that go through a step-by-step process it is very easy however I am not sure what to do when using nntool. Any help would be very much appreciated.
Thank you

답변 (1개)

Michael
Michael 2011년 3월 3일
André, as I understand you are looking for a way to generate a MATLAB file from a neural network. You can save the trained network to a .mat file, but it's not possible to actually generate MATLAB code from the network.
A network is like a black box. It has been trained to perform a certain task, but it can not recover training data nor describe all the necessary training steps it went through once. Simple comparison - I know how to play the piano (more or less) but it's not possible for me to write down a recipe on a piece of paper to enable someone else to play the piano in the exact same way I do, by simply reading my script of instructions.
If you are using a graphical design workflow to perform Clustering (>>nctool), Fitting (>>nftool) or Pattern Recognition (>>nprtool) you may want to capture all the design steps you performed by generating a MATLAB file from the 'Save Results' pane of those GUIs.
Hope this helps,
-Michael
  댓글 수: 2
André
André 2011년 3월 4일
Michael, I appreciate your input to my question but I think maybe I wasn't clear enough in specifying that I would like to generate an m-file of my input to the neural network using nntool.
I know this can be done when using the tools that you mentioned in your reply once the network has finished training as there is an option to generate scripts with the option of generating a simple script or an advanced script. I also know that I could generate the script to a new network in the matlab command window however I would need to change everything line by line. Ultimately I guess my question is if it is possible to generate a matlab script from nntool in the same way it can be done using say nctool or nftool.
My motivation for doing this is because I would be able to create the network graphically and have the GUI do all the dirty work and if there were some minor modifications that I would like to make afterwards I could do so simply by editing the script. The problem with using the other tools is that they don't allow you use different transfer functions and are restricted to one type of network. I hope this clarifies my initial question.
anumukonda sai himaja
anumukonda sai himaja 2016년 3월 2일
please let me know how to view code for a network developed using nntool ??

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by