How do I define which version of matlab to use when calling command from vb.net? - vb.net

I have 3 versions of Matlab installed on my PC. I want to call some Matlab command from my vb.net program. So I created a Matlab object in vb.net and calls the commands. But I want to executes these commands with a specific version of matlab, let's say 2013b, using matlab command window.
How do I do it?

Related

It is possible to write in octave directly in VB.net?

I would like to know if there is a way to directly program in octave - or other open source similar to matlab - within a VB.net project (maybe there are some packages).
In this way I could use the calculation functions of octave (which are more advanced than those within vb.net) and write interface and publish an executable with vb.net.
Thanks

Calling Matlab from VB

I am building an application in VB (VS2012) and the main code is written in Matlab. I would like to call the Matlab scripts from the VB form and also display the results of the calculations in the VB form in a datagrid. Can somebody suggest what my mode of exchange should be?
Thanks for the help.
You have two main options.
MATLAB has a COM interface. From VB, you can start an instance of MATLAB, pass data to it, execute commands, retrieve results, and quit MATLAB. To find out more, take a look at the documentation pages for the MATLAB COM Automation Server. This method will require you to have a live copy of MATLAB present when you run your VB application.
You can use an add-on product to MATLAB, MATLAB Builder NE for .NET (you'll also require another add-on that it depends on, MATLAB Compiler). MATLAB Builder NE allows you to convert your MATLAB code into a standalone .NET assembly or COM component that can be called from your VB application, and distributed with it.
Note that contrary to a comment, MATLAB Compiler alone without MATLAB Builder NE does not allow you to produce .NET assemblies.

How to write a tool which executes tests on c, cpp programs in windows?

I would like to write a tool in windows which compiles a c/cpp program on windows and executes series of tests on them?
It is like Spoj.pl actually.. I wrote a similar thing in linux using fork(). But i could not in windows. Can anyone tell where should i start ?
Windows has it's own functions to create new processes but maybe you don't want to go that way. Instead, find out how to run your C compiler from the command line and then use a scripting language like Python or PowerShell to run it and the tests.
The advantage of using a scripting language is that they have powerful tools to create processes and talk to them; plus Python comes with batteries included so it's very simple using it to create nice reports of the test results.

How to call a MATLAB code from Objective C

I'm planing to write my algorithmic codes in Matlab. And I need to convert .m files into a format where Objective-C can access. When I try mcc, the following error appeared.
The -t switch is no longer supported; the Compiler no longer generates C/C++
source code for M-functions (it generates wrapper functions instead, see
the documenation for -W).
If mcc is not creating C source codes how can i generate wrappers? and do i have to copy both m file and the wrapper in order to make everything working?. And will those wrappers work in iOS??
MATLAB Compiler does not convert MATLAB code into C code, and has not done so for a long time now.
Instead, it archives and encrypts your MATLAB code and creates a wrapper (which could be an executable, a library or, if you have access also to any of the Builder products, a .NET assembly, a Java .jar file, or an Excel add-in). This wrapper dearchives and decrypts your MATLAB code, and executes it against the MATLAB Compiler Runtime, which needs to be included with your application (but is freely redistributable).
You are not going to be able to run the MCR on iOS - its footprint is just too big. If you are targeting another platform with Objective-C, you could produce a library using MATLAB Compiler and call that from your Objective-C.
MATLAB Coder (not the same as MATLAB Compiler) can convert a subset of the MATLAB language into C code. If you are targeting iOS this would be one approach, or you could alternatively run your MATLAB code remotely, and have your app access it via the web.
I'm a little confused by what you have written so I may not be answering your real question:
The Matlab documentation provides clear instructions on how to use the Matlab engine from C programs. Since Objective-C is just C with knobs on, I see no reason why you shouldn't call the engine from an Objective-C program. All that the Matlab engine will see when it is running are valid calls, it has no clue what language the calling program is written in.
I think that for your usage of mcc is irrelevant; what you need is an Objective-C compiler on your Mac. The Matlab documentation suggests that the compiler included in XCode up to v4.1 is OK for Matlab engine applications. In my experience, it may take a little fiddling with compiler options to make a more recent compiler work with your installation of Matlab, but no more than that.
If you plan to use Objective-C calling Matlab, you may not want to start by writing M-files for your algorithmic core. Actually, you probably will, but the Matlab engine doesn't really run M-files, it executes commands sent to it by an external program, such as your Objective-C program. Your development route might be (1) write M file to implement algorithm, then (2) write Objective-C program calling Matlab engine at critical steps when the Matlab functionality is required. You could write your application to make the engine run an M-file (I think) but this is outside my experience.
While you can use Matlab to run a compiler to build your programs, in this case you are probably better using XCode (or your preferred Mac IDE) to build your programs, taking care to ensure that the right linkages are made to the Matlab engine. Again, the documentation explains what you need to do.
No wrappers are involved. No M-files are required. And good luck getting the Matlab engine running on iOS !

What replacements are available for vbscript in an application?

An application I maintain has been around since VB6 days - ported to .Net 1.1, and now being updated/rewritten across to .Net 3.5
The application provides a mechanism to run VBScripts - this was done in a highly integrated way - allowing the program to parse multiple .vbs files and produce a list of all of the subroutines and functions - which were then available within the application alongside core functions.
Previously this was an embedded msscript.ocx - in the first .Net conversion, this was wrapped in Interop.MSScriptControl.dll, however, on Windows 7 this just isn't working.
It looks like this is really not the way to be doing this anyway - Microsoft seem to be trying to kill vbscript.
Is there a 'supported' way of using VBScript, or is it time to move on? and if so, where is there to move to that provides the same sort of functionality?
PowerShell is the really the way you want to go if you want to do scripting. Here are some of the new features in PowerShell on Windows 7. Here is a VBScript to PowerShell conversion guide.
There are also tons of great resources over at PowerShell.com including a nice IDE.