MATLAB Answers


Generate C Code from MATLAB Coder

Asked by Pankaja Tanjore on 10 Jul 2015
Latest activity Commented on by Ashish Uthama on 13 Jul 2015
I have written the MATLAB code to Erode an image. I have tested the image in MATLAB and i am getting the correct output. I have generated the C code for this MATLAB code using MATLAB C Coder.
I am following the below mentioned steps to generate the C Code
i) Go to Apps => Click on MATLAB Coder .
ii)Browse and select the function for which you want to generate the C code .Click on Next
iii) Select the function and define the Input image type and size.Click on Next
iv)Click on Settings tab in the next page.Click on All
Support non-finite numbers : Select No (By default it is Yes) Click on Next
v)Click on Generate to generate C code.C code is generated successfully.
The following files are created : 1)Erode_Image.c 2)Erode_Image.h 3)Erode_Image_initialize.c 4)Erode_Image_initialize.h 5)Erode_Image_terminate.c 6)Erode_Image_terminate.h 7)Erode_Image_types.,h 8)padarray.c 9)padarray.h 10)rwtypes.h
Now I want to test this C code in Visual Studio by creating a test bench.
When i create a testbench and compile the project I am getting an error that 'libmwmorphop_nonflat_tbb.h' is not found.
This file is not existing in the generated C file.
It would be grateful if you let me know how to fix this problem.I need to test my generated c code in Visual Studio.
I am attaching here all the files that are generated from MATLAB C coder . I am also sending you the MATLAB code which i have written to Dilate the image.
Looking forward to hear from you at the earliest.


Sign in to comment.


1 Answer

Answer by Ashish Uthama on 10 Jul 2015

Look at packNGo functionality. That should pack up all the required files for you in one zip file.


Hello, I am not clear about packNGo. It would be grateful if you let me know the procedure to do this.
Did you get a chance to click the link in my answer? It does have a step-by-step procedure.

Sign in to comment.