Monday, 4 May 2009

Matlab Neural Network in C# Application

Part 1 gives an overview of Matlab Network manager . This screen cast shows how to create XOR network using Matlab Network Manager.

This part explains how to use Matlab Neural Network in c# windows application and limitation of Matlab complier with respect to 'sim' function.

Note:- Don't forget to watch next episode of this series, in which I have explained how to get around with 'sim' function compiler limitation and call Neural network from c# windows application

In this part I have explained how to get around with 'sim' function compiler limitation and call Neural network from c# windows application.


  1. Excellent tutorial .... I was searching for how to call matlab trained network (face recognition) from program and this tutorial gave me solution to my problem. Keep posting good things like this.


  2. Thnkz a lot i appreciate ur excellent help
    Nuwan Kumara

  3. I am really impressed by your blogs and writings. I read through your emails and check your blog from time to time.

    However, I would like to tell you that I am not proficient in VB, actually being from the Mechanical Engineering department I have never used VB. But being a computer enthusiast, I know I can make simple forms if i get a guidance. I have done coding in Matlab, C++, BASIC and FORTRAN.

    Can you tell a beginner user of VB that how you made the simple VB application where you had that 'sim' button and the final output in that text area? I guess you can explain it very effectively in one screencast and it would save tons of time for beginner users like me.

  4. Hi Mukul,

    Thanks for your comments.
    First of all I have used 'C#' windows application not VB.

    Initially I thought of preparing one screencast,but due to video length (Max 10 min.) limitation in youtube I logically split the video into three parts and uploaded the same.

    I don't do coding in VB nowdays (I believe like others VB is too old :-) ) But If you stuck with a particular issue do let me know,I will try my best to resolve it.

  5. This comment has been removed by the author.

  6. Hi,
    Really thanks a lot for your great works....
    Best of luck...

  7. hi..very helpful tutorial..but i got an error..
    in C#:
    using MathWorks.MATLAB.NET.Arrays;
    the error is: The type or namespace name 'MathWorks' could not be found (are you missing a using directive or an assembly reference?).

    is there any others library should be add? tq for your help..

  8. Search for MWArray.dll in your computer

  9. it's brilliant work. and now my problem is gone!
    but I have a question.
    Is it working in Console Application?
    My ConsoleApplication test was failed. but WinForm is working.

  10. Very good tutorial. But in the Xor problem i guess the inputs are not normalized coz they are between [-1 1] . But generally the sim function will apply some preprocessing and postprocessing functions for nomalizing . So any idea how to do them in C#

  11. wow thanks for your tutorial it's great,
    but can you make a tutorial about how to simulate neural network using simulink? i really need your help

  12. hi..i am doing my thesis right now that related with ANN using matlab..the topic of my thesis is automatic classification of electroluminescence images of solar cells based on neural networks..this is my first time working with ANN in matlab..therefore i really hope that anybody here could help me working with ANN in matlab and give me some tutorial in using ANN in matlab..hope you could make one tutorial about ANN using matlab for pattern recognition..thank you..


  13. Interesting blog, i usally be aware all about all different kind of sofware. i am online all the time, and this action allowed me to see a site costa rica homes for sale and i like it too much, beyond all doubt without my computer and a great network i never would have seen this site too.

  14. hello, How I can do a GUI that contains a username and password ?

  15. Hello, It's really excellent tutorial. I am doing my research in neural networks (application in numerical analysis), since i m frm the bckgrund of mathematics so i found difficulty in doing this, but ur tutorial helps me alot. Thanx for this. But can we also apply this in solving differential equations?

  16. Hello! I have one problem when I call matlab function form csharp to create neural network. It have problem about 'set adaptFcn' in subsasgn.m file. I had checked function and tested it on matlab but not have any problem!

    can everyone help me! Thanks all!!

  17. Hi! thanks for the tutorial, i can solve the problem of sim function with:


    regards, James

    1. This is what i was searching for several days. Thanks!!!

  18. hi,i'm in the last year of my study and my project is segementing images with neural network in matlab and i cnvert images to matrice but i don't konw how i put it in the nntool and what's the good function for training my neural network

  19. Thank you for this video. It is helpful. Can you help me? How to make a 5 input parameters for the network instead of two?