Click here to Skip to main content
Licence CPOL
First Posted 20 Aug 2004
Views 61,688
Downloads 1,539
Bookmarked 29 times

Calling Matlab Neural Network From Other EXE's

By | 12 May 2009 | Article
This article describes how to make Use of matlab Neural Network Tool Box from Other environments like VB,C++ etc

Introduction

     This Article And Source Code Intended Those Users Who Are Working On Neural Network Related Projects.In This Article ,i am using MATLAB 6.5 Neural Network ToolBox To Create Neural Network And Call The Same From Other Environments Like VB,C++ etc..

Description

           Step 1:-- > Design A Nueral Netwrok Using Matlab NN tool box.

                 for Eg:- net = newlind(P,T);  P = Inputs , T = Targets

[There's Lots Examples In Matlab Which Describes How To Create Neural Network  ]               

            Step 2: --> Write .M file  which create the Nueral Network According to our Inputs.[refer:- CreateNN.M in the demo Project]

            Step 3:--> Add Code To Save Wokspace using the command "save" in the CreateNN.m file   [ you can specify the location ].Now Trained Network Saved.  

           Step  4:--> Write Another .m file which loads Trained Network And Apply Simulate Function.Result can be saved to datbase or a text file.[ refer :--> ApplySimFun.m]

           Step  5:--> Now we have to integrate(execute) .m file as part of our application.In order to that we have to Invoke Matlab As Automation Server.

Demo Project Description

How To Test The Apllication

i wrote two sample file .m files , foldername Samples_NN_Files

step1 , copy Samples_NN_Files  Folder to c:\   
       folder contains two .m file ,
       file ,CreateNN.m  ->  creates the network , save the network to c:\Samples_NN_Files
       file , ApplySimFun.m -> loads the network from c:\Samples_NN_Files apply the    simulate        function, write the result to a log file C:\NNResult.log"

Step2 , u have to call these file(execute) from .exe(vb,vc,c++)   , In order to do that u have to         invoke matlab as automatomation server.  for this purpose i wrote wrapper dll called CMatlabEngine.dll.
       so register the dll ( command line:- regsvr32 CMatlabEngine.dll)  file (Note:  i am using Matlab 6.5 version so , if u are using anyother versions there may be version conflict)
       u can find the dll file in vb_dll_matlab folder ( actually it's vb project for creating         matlab wrapper, so go through the code")          
          
step 3 ,there's sample programm written in vb ,Call_NN_From_VB which call the matlab execute the Network shows the result to testbox

  Conclusion      

          Hope You Will Enjoy.Any Doubts Feel Free To Contact Me.Actually I wrote examples in VB 6.0.But you can Invoke The  CMatlabEngine.dll. from c++ using #import Statement.

Update :- you can watch my screencast on using matlab Neural Network in C# application here 

.This approach doesn't require Matlab to be installed in client machine. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

BAIJUMAX

Architect
Max Corp.
India India

Member

I am BaijuMax.Now working as Senior Systems Engineer.
 
Tech. Interests :- C#,Winforms,Asp.net,VB.net,VB,Sqlserver-2000,Analysis services,Matlab,Neural networks etc...
 
Hobbies :- Watching Sci-Fi Movies.
 
Dream & Vision:- Intelligent OS , Space Travelling.
 
Contact:- Baijumax@rediffmail.com,Baijumax@yahoo.com
 
My Blog:- http://www.baijumax.blogspot.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questionwater demand forecasting using neural network(matlab) Pinmemberniranjan25881:00 10 Oct '11  
QuestionI have this error Interop type 'MLApp.MLAppClass' cannot be embedded. Use the applicable interface instead. Pinmemberpocho21015:47 20 Sep '11  
Generalregarding MATlab Pinmemberaruntry19:13 22 Dec '09  
GeneralNeed help Urgently PinmemberMember 24465607:11 26 Jun '08  
GeneralMATLAB is not installed PinmemberA.E.K7:30 3 May '08  
GeneralRe: MATLAB is not installed PinmemberBAIJUMAX6:00 24 May '08  
Questionhow to detect abnormal data by training a rule using matlab? Pinmemberphoebe42122:31 16 Mar '08  
Questionplease help me Pinmembermiro_soft12:33 11 Apr '07  
AnswerRe: please help me Pinmemberdayananda c s23:22 15 Dec '09  
GeneralMy Big Problem PinsussAnonymous21:58 18 Aug '05  
GeneralMy Big Problem-MAHDI FAHMIDEH PinsussMehdi Fahmideh20:53 18 Aug '05  
GeneralRe: My Big Problem-MAHDI FAHMIDEH Pinmemberexpressdual23:37 1 Apr '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 12 May 2009
Article Copyright 2004 by BAIJUMAX
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid