Results 1 to 7 of 7

Thread: How to convert MATLAB to C?

  1. #1
    Join Date
    Aug 2006
    Posts
    201

    How to convert MATLAB to C?

    Hello Friends,
    I have recently joined the digital signal processing. I am having the MATLAB codes. I want to convert these codes into C programming language. I have also tried to convert the Matlab codes to C code by using the Matlab compiler. But I am getting some errors in the header file of C. Does anyone know how to convert MATLAB to C? Please tell me, so that I can convert all Matlab codes to C.!!
    Don't be afraid of darkness, it's in your heart anyway.

  2. #2
    Join Date
    Jul 2006
    Posts
    286

    Re: How to convert MATLAB to C?

    You have to convert the MATLAB algorithms into C code manually, some years ago. Which was the slow process also many errors were used to happen. But nowadays you can use the Catalytic MCS for generating C automatically. For signal processing algorithm developers, MATLAB from the MathWorks is an essential tool. Creating the C-code model requires developers to manually translate their algorithms into C and to temporarily freeze algorithm changes. Using the Catalytic MCS can greatly ease the task of integrating MATLAB algorithms into existing C-code.
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

  3. #3
    Join Date
    Nov 2008
    Posts
    996

    Re: How to convert MATLAB to C?

    I would like to suggest you to check your coding again. Perhaps there may a simple error with the include path of the compiler or something like that. Because as far as I know the Matlab to C converter works and is a well-established way to accomplish this kind of thing. What kind of errors are you getting within the header files.?? Try to include the path properly and also check the coding that you have written. Otherwise you can use the converter.

  4. #4
    Join Date
    Nov 2008
    Posts
    1,192

    Re: How to convert MATLAB to C?

    You can also use the One-button MATLAB-to-C Conversion for converting the Matlab to C. I think it would be useful to use this application for the conversion. Also I have observed that the Matlab to C Conversion (by default) don't actually generate C code. Instead they pack up the interpreter as a standalone executable. The Catalytic One-button MATLAB-to-C Conversion has a matlab-to-C translator, which translates M to ANSI C. Hope that using this will be more useful.

  5. #5
    Join Date
    Mar 2008
    Posts
    672

    Re: How to convert MATLAB to C?

    If you want to dump C/C++ data into Matlab workspace in run-time to visualize data and facilitate debugging, you can use the following code :
    Code:
    unsigned char rgb_img[44*256*172]; // 3D signal, i.e. color image
    // initialize rgb_img and do something to it...
    const char* command = "figure; imshow(I)";
    
    // Dump it as 3D matrix named I. column(width):256?row(height):172 and page(channel):44,
    // then view it using matlab function "imshow".
    matlab << name ("I")
      << width (256) << height (172) << channel (44)
      << start (rgb_img)
      << cmd (command);
    only the drawback is that calling engine APIs directly seems not to be that convenient.

  6. #6
    Join Date
    Mar 2008
    Posts
    349

    Re: How to convert MATLAB to C?

    For the above example you can also use the openCV, because it is also supported. Check here for the coding :
    Code:
    IplImage* pimg; // openCV image types
    // initialize p and do something to it...
    
    // Dump pimg as matrix I. The size and types are made the same as pimg automatically.
    // Then view it.
    matlab << name("I") << var(pimg) << cmd("figure;imshow(I)");

  7. #7
    Join Date
    Apr 2010
    Posts
    1

    Re: How to convert MATLAB to C?

    hello
    I am in need of help. I seek the program Catalytic Mcs. I am a Tunisian student and I can not buy. so if there is a link to download or another program to translate the MATLAB C

Similar Threads

  1. How to begin with MATLAB?
    By Jacques25 in forum Software Development
    Replies: 3
    Last Post: 18-01-2011, 06:57 AM
  2. Matlab 7.9 crashes under Windows 7
    By Chandranath in forum Windows Software
    Replies: 5
    Last Post: 13-01-2010, 02:58 AM
  3. Probabilities in matlab
    By Brunoz in forum Software Development
    Replies: 5
    Last Post: 05-01-2010, 10:03 AM
  4. Free MATLAB CD and Technical Kit
    By Shikhar in forum Ebooks
    Replies: 3
    Last Post: 06-03-2009, 07:35 PM
  5. Calling winrar from matlab
    By go raiden in forum Software Development
    Replies: 5
    Last Post: 02-09-2008, 08:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •