zoukankan      html  css  js  c++  java
  • Calling Matlab Neural Network From Other EXE's

    转自http://www.codeproject.com/KB/DLL/MatlabNN_BKM.aspx

    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. 

  • 相关阅读:
    [开发笔记]-使用bat命令来快速安装和卸载Service服务
    [开发笔记]-多线程异步操作如何访问HttpContext?
    [开发笔记]-Windows Service服务相关注意事项
    [开发笔记]-VS2012打开解决方案崩溃或点击项目崩溃
    Chrome 开发者工具有了设备模拟器
    Mysql查看数据库表容量大小
    golang操作mysql数据库
    golang命令和VSCode配置
    golang广度优先算法-走迷宫
    golang爬取免费代理IP
  • 原文地址:https://www.cnblogs.com/xiangshancuizhu/p/2245437.html
Copyright © 2011-2022 走看看