Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB Conversion Help (to c or c++)

  1. Feb 27, 2010 #1

    I have made an application in MATLAB, well the technical part with the use of the tool-kits built in.

    Now i need to get that information from MATLAB in the form of c or c++ so i can import it into visualstudio and made a GUI and add features such as database and demo/reg models.

    Thing is, i have no idea how or if its even possible?

    All i can see is that it can be made into a format so it can be called as a com object.

    I am looking at going over to MAC, any ideas if i can compile this so i can be run via X-Code which i am led to think is Objective-C?

    Thanks for any help. If you think another forum might be better too, please tell me and i will move it, or repost it...
  2. jcsd
  3. Feb 27, 2010 #2
    I'm so horribly confused. Do you need to port (translate) your existing matlab code to C/C++ or make your matlab code callable from C/C++?

    You can't run stuff compiled in visual studio on a mac 'cause vs uses native windows stuff when compiling, but you can totally run C/C++ on mac.
  4. Feb 27, 2010 #3

    I'm afraid I don't have much of an idea what you're talking about either. Firstly, Matlab has its own GUI creation tools that you can use to set up GUIs to control your code; you can then generate standalone executables using Matlab that bundle your application code and the GUI code for deployment to users who don't have Matlab installed.

    What I think you're really after is the following. Matlab allows you to compile Matlab code to shared libraries that you can then call from other code. It's perfectly conceivable that you could write, say, Matlab code to implement an optimization library, compile it to a shared library using the Matlab compiler, and then call this library from code written in Visual Studio. However, although the latest versions of Matlab make this much easier than it was in the past, it's far from trivial, and the fact that your question is so vague makes me suspect that you might find it challenging.

    See the Matlab Compiler docs for much more information on this, including examples. There are loads of relevant docs on this precise topic in the Matlab help system.

    XCode is a development environment on OS X which allows you to write code in Java, C/C++, Objective C, Python, Ruby, and so on. It's a decent tool for creating software on the Mac but it's nothing in comparison to Visual Studio. Calling Matlab shared libraries on a Mac is possible but you'll need to have experience with using threads to create and manage access to the library safely. Again, this is far from being trivial and isn't something an inexperienced programmer could do without difficulty.
  5. Mar 4, 2010 #4
    Sorry, i am a master of been vauge, i am really not as uneducated as i may sound.

    - What I Have

    I have an application i have made in MatLab. I cant say what it is without making you sign an NDA, and even then I doubt i could get approval, so will have to just call it an "application".

    Its using the imaging, and financail toolbox within MatLab, and it all runs like i want it to, so the MatLab side is fine.

    - What I Want

    I want to put my MatLab application on a mobile platform. We are using Blackberry, IPhone and Windows Mobile.

    I need to port it to "one" for proof of concept, but it would be good if that "one" was the IPhone as its got 70% usuage in my company, followed by blackberry, and just a few with the Windows Mobile Platform.

    I have took on more than I am experienced with, I am good at MatLab Code, and good at C, but thats about it.

    So what I will do is work in a project management roll and get an outside contractor to do the code.

    - Problem

    I dont have a clue on the technical side, and i want to understand how one can use MatLab code, say on the Iphone.

    I would like to understand whats involved, for example compile MatLab to ? and then use X-Code to program the application.

    I understand i have to join apple dev to get the sdk and way to distribute, which is one thing.

    So is it

    A) Possible to call a matlab compiled object on iphone?

    B) Using X-Code?

    C) Is there a better way (web app)?

    D) Is it a simple case of compiling MatLab code, and then calling it from X-Code?

    Once i get a feel of what involved, i can get some quotes from coders, if any are here, i would be glad to talk business, but i realise this is not a freelance website and dont want to violate any rules here.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook