Can I run MATLAB code on a web site?

 I have a BE project whose code is in MATLAB but I need to present results on a web page. I want to know whether I can run my code directly on a web site? If not, could you tell me which language would be a better option? I'm thinking maybe ASP, HTML and PHP.  

NOTE:-


Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.   

Answer: 

You can compile your MATLAB application into a stand-alone executable using MATLAB compiler.

Type "mcrversion" at the prompt to determine whether you have this package installed- It's likely that you don't if you haven't paid for it- As with most extensions that Mathworks provides, you need to pay for it.

If you don't need to compile your code, but simply run it, you may be able to invoke MATLAB through the command line to do what you need it to.

As Sinan mentioned, you would use a function like passthu in both of these cases.

Another alternative is to create an extension for PHP to utilize MATLAB in C. MATLAB provides a C API which allows you to call the engine using libraries that come with MATLAB (see your "extern" folder for examples).

See the following link on creating the extension (It is quite easy):

http://devzone.zend.com/article/1021 

Search for "MATLAB C/ Fortran API" in MATLAB or google for the documentation on functions. Basically, you'll probably need to call EngOpen to call the engine and return a pointer.

Evaluate a string using engEvalString (you can load .m files this way or do anything you could do in the typical matlab command-line).

When you need to see the results (anything that is usually output to the command line in matlab), simply omit the semicolon after the command and use engOutputBuffer to capture the output.

Here is a simplified example from something I wrote: 

 

 

#include "mat.h"
#include "engine.h"
#include 
#include 
#include 

#define  BUFFER_SIZE 256

int main()

    Engine *ep;
    char buffer[BUFFER_SIZE];   // The buffer used to capture output.

    buffer[BUFFER_SIZE] = '\0'; /* Terminate the last character of the buffer. */

    if (!(ep = engOpen(NULL))) {
        fprintf(stderr, "\nCan't start MATLAB engine\n");
        return EXIT_FAILURE;
    }

    if (engEvalString(ep, "load data/mymatfile.mat") != 0)
    printf("error evaluating expression\n");

    engOutputBuffer(ep, buffer, BUFFER_SIZE);

Comments

Popular posts from this blog

programmingshark

Constructing piecewise symbolic function in Matlab