Thread: C/C++ and Matlab?

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    14

    C/C++ and Matlab?

    Hi everyone. I have always wanted to execute a C/C++ code for use in simulation and outputting the data in a file. Then, afterwards execute an M-file in matlab to plot the said data. I was wondering is it possible for C/C++ to instantiate a command prompt and execute a batch file after the end of execution? Or do anyone know of ways to integrate C/C++ with matlab? The reason I want to use Matlab is because its so much easier to use for plotting data. Is there a C/C++ equivalent? Thanks!

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    1) The means of instantiating a command prompt and executing a batch file are both operating system and compiler dependent (in terms of how you do it from C/C++, what command processor is launched, and how you specify the script). Under most windows compilers, the system() function will be a place to start.

    2) Mathworks (the mathworks vendor) provide a means of executing C and Fortran functions from matlab. Look up MEX-files in the mathworks documentation for discussion of one approach.

    3) There are plotting and graphics libraries for C/C++. Again, these are compiler and operating system dependent.

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    14
    Thanks! I think the second option is the best way. Its just so much easier to use matlab to plot, so I'm goign to avoid the third suggestion.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. uninstalling matlab
    By BEN10 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-08-2009, 10:10 PM
  2. Convert Matlab Algebraic Sol to C compatible
    By Takeshi in forum C Programming
    Replies: 3
    Last Post: 01-08-2009, 06:35 PM
  3. MATLAB error
    By chico1st in forum Tech Board
    Replies: 1
    Last Post: 06-17-2008, 03:39 PM
  4. MATLAB importing C libraries
    By chico1st in forum C Programming
    Replies: 1
    Last Post: 05-29-2008, 02:01 PM
  5. HELP in MATLAB to C conversion
    By itachi in forum Tech Board
    Replies: 0
    Last Post: 01-08-2006, 02:26 AM