Forums

Re: How to call C program from Matlab?

Started by chri...@gmail.com June 1, 2006
>
>
>
> Hello :),
>
>I did some mex programming and some digital image
>processing implementation for my final year project.
>Attached is the report I have compiled from my final
>year thesis and hope this will help you to understand
>mex-programming better.
>
>Best regard,
>Matthew Tan
>
>--- Tan Thiam Huat <> wrote:
>> Hi All,
>>
>> I have a simple C program (io.c) for I/O functions.
>> How do I call the C program from Matlab. I
>> understand there is a mex function to do that. But
>> there is still a lot of technical details which I am
>> quite confused, example the mxArray, etc. could
>> anyone help?
>>
>> The purpose of io.c program is merely to control the
>> pins of the I/O card of 8255. I could compile that
>> with Labwindows/CVI. But I need to interface with
>> Matlab, because I need to interface other programs
>> in Matlab.
>>
>> outp( 0x143,0x80); /* Control Register */
>> outp( 0x140,0xff); /* Port A: Pin 1 to Pin 8
>> */
>> outp( 0x141,0xff); /* Port B: Pin 9 to Pin 16
>> */
>> outp( 0x142,0xff); /* Port C: Pin 17 to Pin 24
>> */
>>
>> /* 0x143, 0x80, etc are all in HEX. */
>>
>> do we need a Visual C++ program to integrate with
>> Matlab? That means I need to convert my io.c to
>> rename as io.cpp? then I type
>> >> mex io.cpp
>> from Matlab prompt?
>>
>> Thanks so much. Would appreciate if someone could
>> help me by today.
>>
>> Best regards,
>> Thiam Huat
>
>
>
>
>
>
>
>
> Attachment (not stored)
>
>
>
> MexReport.pdf
> Type: application/pdf
>
>
>
>
>
>
>
>
>

Hi,

I was just looking over this message and i know it is from 2002 but do you still have that final year project thesis. I would be interested to see it since i need to know how to integrate/ call a C program from Matlab.
ChrisJ.