Matlab Program For Dolph Chebyshev Array Shoes

Posted on by admin
Matlab Program For Dolph Chebyshev Array Shoes Rating: 4,1/5 7286 votes
  1. Aris Alexopoulos
Radar

Posts about chebyshev array written by zinka. Tag: chebyshev array. But, a devoted tool providing all possible solutions for antenna arrays is not. So, I decided to create a GUI program based on MATLAB which can answer at least. A simple linear Dolph-Chebyshev array (polar radiation pattern) Pattern-Multiplication.

Active6 months ago

As the title indicates, I have MATLAB code for isolated spoken words recognition, and I want to be able to integrate this project with another one made with PHP for some purpose.

I have not used to deal with such problem before. In other words, it's the first time for me when I need to integrate PHP and MATLAB, so I really don't know where to start and how.

I have read a couple of articles, but I couldn't make it valid.

I have PHP 5.4.9, MATLAB R2012A and Windows 7.The MATLAB project files can be seen on GitHub.

Peter Mortensen
14.4k19 gold badges88 silver badges117 bronze badges
mamdouh alramadanmamdouh alramadan
6,6125 gold badges28 silver badges51 bronze badges

4 Answers

You have a few options here:

  • is MATLAB installed on the server where the PHP application would be deployed (not your current development environment)? If so you can invoke it directly just like any other program (maltab -r '...') using whatever is the equivalent of EXECUTE command in PHP. Here are some resources (make sure to also checkout the linked questions as well):

    Others have commented on how to pass input/output between PHP and your MATLAB script. For example you could design your MATLAB function to receive the path of WAV file as input, process it and save any resulting image to disk:

    Which is invoked from PHP as:

    you could then read the output image in the PHP app.

  • If not, what deployment-related toolboxes do you have available? MATLAB Compiler and related toolboxes like MATLAB Builder NE and MATLAB Builder JA.

    Those will compile your program into an executable/.NET Assembly/JAR file respectively, and all of them require the freely available MCR Runtime to be installed. In other words, the executables do not need to have a full MATLAB installation on the target machine, only the MCR runtime.

    You would run the executable in the same manner as before.

    Another product is the MATLAB Coder, which converts your MATLAB code into C++ program. When compiled, it can run without any external requirement.

    A new product by Mathworks is MATLAB Production Server. Personally I know nothing about it :)

  • Yet another option is to use TCP/IP to communicate between PHP and MATLAB. A server would be run on the MATLAB side, using socket programming written as C MEX-file or a Java class. See:

    The client being your PHP app. The idea is to have MATLAB listening for connections, reading whatever input is given by a client, eval it, and return the result. This is more involved than the other options, as you have to deal with serialization and other things like concurrency. The advantage is that MATLAB can be run on a separate server, even on multiple servers on the cloud (see this post).

So first, decide what approach best suits your project, then it would be easier to answer specific questions.. Just always consult the docs first, MATLAB toolboxes are very well documented and usually include many examples. Here are a couple more resources specific to MATLAB Compiler products family:

Note that they concentrate on ASP.NET and Java JSP/servlet applications. In your case, the PHP application would communicate with a middle tier running a web service built using one of the above two options (or simply design a CGI-like site running plain executables built using the MATLAB Compiler as explained earlier)

HTH

Community
AmroAmro
117k21 gold badges218 silver badges404 bronze badges

To help OP with running system commands from a php webpage, my post here is relevant (copied below).

We do exactly this all the time. I call them voodoo pages. Here's some working code:

And the output to the webpage served:

And the additional note I added in the comments below:Relative vs absolute paths may be a pain... $command might need to be /usr/bin/uptime or another could be /usr/bin/ls /home/chris/ftp. Normally, scripts' working directory is where they live in the file system. MATLAB is a windows program, yes? My experience is you will need absolute paths for the program and any files passed as arguments, example: $command='c:matlabmatlab.exe c:wwwsomefile.wav' And then single quotes required for silly NTFS names, TAB command line completion works well for examples. Or use proper 8.3 name with the ~ in it.

Community

Aris Alexopoulos

Chris KChris K
16.5k2 gold badges26 silver badges41 bronze badges

One quick hack would be to compile your Matlab code into an executable file then use PHP's shell_exec().

The difficult part would be adapting your Matlab code (sorry, I didn't read it) in such a way that:

  1. It will receive its input in command-line-interface style (as char strings);
  2. It will output its results as text to standard output (file id #1 in Matlab).

Then all it takes is to parse the Matlab output back into PHP...

Community
user2271770

my answer would be in two parts :

1- how to run matlab script from terminal ? - I will give some example about running matlab script from terminal

matlab in windows , must be in your environment path . how to ?

if you need to compile your script to java :

2- how to execute terminal command from php ?I think the answers above are good , no need to repeat them .

more notes :

  1. watch for your security , you might be xss ed easily
  2. abstract your code and improve it to save params & output to database , run your code inparallels or queue manager , you might create REST service.
  3. unit test .
  4. use linux , its much more powerful.
tawfekovtawfekov
4,6263 gold badges24 silver badges46 bronze badges

Not the answer you're looking for? Browse other questions tagged phpmatlabmatlab-deployment or ask your own question.