Importing a MATLAB code from the workspace?

Post Reply
Posts: 5
Joined: Fri Jun 03, 2011 7:27 am

Importing a MATLAB code from the workspace?

Post by flash87 » Tue Jun 28, 2011 12:12 pm

Hi Kerhuel,
Can u please me tell me how can I import a code that i have written in MATLAB from the workspace to your dsPIC blockset, so that when compiled it generates a hex file which can be further imported to the dsPIC.Please provide me some inputs on this as my project deadline is fastly approaching.


Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France

Re: Importing a MATLAB code from the workspace?

Post by LubinKerhuel » Tue Jun 28, 2011 7:14 pm

Simulink has a block that allows to embed matlab code.
Note however that embeded code might react differently from your matlab function on high level function like svd or eig. The order of the eigen value return does not follows the same rules when comparing between code execution in embedded matlab block and standard matlab script.
Note also that generated code is not that efficient (However, it seems that this has progressed in the Matlab latest version : 2011a). You will also loose possibility to fine tune your algorithm with fixed point.

This beeing said, I would not recommend to just copy-past a matlab script within simulink so as to get embedded code. Developing algorithm directly within simulink should provide much better results.
The embedded matlab code should only be used for very simple operation that might be difficult to describe using simulink.


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest