Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
C versus Mex in matlab

Subject: C versus Mex in matlab

From: Louis

Date: 19 Oct, 2010 23:57:03

Message: 1 of 3

Hello guys,

My thesis is in object detection so the speed is crucial. I did finished a working matlab code that does the job however i am not succeeding in making it to run in real-time which i understand matlab's main concept is to prove the concept. So my question now:

I know implementing a mex file will significantly increase the speed, do you think i should change the whole project to C or only mex the bottleneck loops?

The reason why i am asking this question is that my knowledge in C is close to none so it will be difficult to implement everything in C :).

Thank you in advance for your advise

Louis

Subject: C versus Mex in matlab

From: Rune Allnor

Date: 20 Oct, 2010 04:55:33

Message: 2 of 3

On Oct 20, 1:57 am, "Louis " <wlo...@ryerson.ca> wrote:
> Hello guys,
>
> My thesis is in object detection so the speed is crucial. I did finished a working matlab code that does the job however i am not succeeding in making it to run in real-time which i understand matlab's main concept is to prove the concept. So my question now:
>
> I know implementing a mex file will significantly increase the speed, do you think i should change the whole project to C or only mex the bottleneck loops?

Only do the bottlenecks. In the context of a thesis your main
goal is not to produce world-class performance, but to prove
the concept. If you have the time, MEX to remove some bottlenecks,
just so you understand something about how to do that, and what
kind of efforts are involved, but don't start thinking about
doing the whole thing in C. That's for your paid carreer, after
university.

> The reason why i am asking this question is that my knowledge in C is close to none so it will be difficult to implement everything in C :).

It takes years to learn and master C or C++ to the level where
you gain speed, stability and maintainability. If you are still
in college, take a class on C++ programming. C++ is based on
C, but is somewhat better suited for the general programmer,
but with enough potential to significantly speed up a lot
of stuff you might be tempted to do with matlab.

Rune

Subject: C versus Mex in matlab

From: Louis

Date: 22 Oct, 2010 13:06:03

Message: 3 of 3

Thank you Rune.. I started mex'ing' my loops :)...

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us