Got Questions? Get Answers.
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:
error on using variables and matlab function within embedded func. simulink component

Subject: error on using variables and matlab function within embedded func. simulink component

From: Niveen Morsi

Date: 26 Feb, 2013 12:44:08

Message: 1 of 8

Hello all,

i'm using embedded function component within simulink, but when i use aviinfo() or mmreader() i get an error message "is not supported by Embedded MATLAB for code generation."
this also takes place when using randint() or randi()

when declaring variable that is not persistant and assign value to it
i got this error "Undefined function or variable"

any idea how can i solve this...


thanks..

Subject: error on using variables and matlab function within embedded func. simulink component

From: Phil Goddard

Date: 26 Feb, 2013 15:16:08

Message: 2 of 8

Any functions not part of the Embedded MATLAB subset must be defined as being eml.extrinsic (or more recently coder.extrinsic).
Search the doc for those terms.

Phil.

Subject: error on using variables and matlab function within embedded func. simulink component

From: Niveen Morsi

Date: 11 Mar, 2013 13:15:09

Message: 3 of 8

"Phil Goddard" <phil@goddardconsulting.ca> wrote in message <kgijjo$n95$1@newscl01ah.mathworks.com>...
> Any functions not part of the Embedded MATLAB subset must be defined as being eml.extrinsic (or more recently coder.extrinsic).
> Search the doc for those terms.
>
> Phil.


how can i define it as being eml.extrinsic ???

Subject: error on using variables and matlab function within embedded func. simulink component

From: Phil Goddard

Date: 11 Mar, 2013 15:03:07

Message: 4 of 8


> how can i define it as being eml.extrinsic ???

There is a brief example here:
http://www.goddardconsulting.ca/simulink-using-embedded-matlab.html

But as per my original message,

 > Search the doc for those terms.

Phil.

Subject: error on using variables and matlab function within embedded func. simulink component

From: Niveen Morsi

Date: 11 Mar, 2013 19:52:05

Message: 5 of 8

"Phil Goddard" <phil@goddardconsulting.ca> wrote in message <khkrnb$32p$1@newscl01ah.mathworks.com>...
>
> > how can i define it as being eml.extrinsic ???
>
> There is a brief example here:
> http://www.goddardconsulting.ca/simulink-using-embedded-matlab.html
>
> But as per my original message,
>
> > Search the doc for those terms.
>
> Phil.


thanks alot Phil... i will check it out right now..
one more question please..

do you have any idea how can i convert matlab file into vhdl component...

thanks alot..
Niveen

Subject: error on using variables and matlab function within embedded func. simulink component

From: Niveen Morsi

Date: 12 Mar, 2013 00:10:16

Message: 6 of 8

"Phil Goddard" <phil@goddardconsulting.ca> wrote in message <khkrnb$32p$1@newscl01ah.mathworks.com>...
>
> > how can i define it as being eml.extrinsic ???
>
> There is a brief example here:
> http://www.goddardconsulting.ca/simulink-using-embedded-matlab.html
>
> But as per my original message,
>
> > Search the doc for those terms.
>
> Phil.

when i tried eml.extrinsic('');for aviinfo() and aviread() methods, it works and the error used to occure is no longer appearing...
but i couldn't retrieve data from output object
like this

info = aviinfo(video);
offset_frame =info.NumFrames; %1

mov = aviread(video , offset_frame );
image = (mov.cdata);%2

i got error for both statements 1 & 2
Attempt to extract field 'NumFrames' from 'mxArray'.
Attempt to extract field 'cdata' from 'mxArray'.

any idea how to overcome this plzzz..

thanks alot..
Niveen..

Subject: error on using variables and matlab function within embedded func. simulink component

From: Phil Goddard

Date: 12 Mar, 2013 01:03:06

Message: 7 of 8

I don't have any direct experience with aviinfo or aviread within a MATLAB Fcn block but suspect that because they return objects, and you need to call the methods (i.e. functions) that manipulate those objects you'd need to define all the methods as being eml.extrinsic too.

Alternatively, you will most likely find it easier to write an m-code S-Function to do whatever you are trying to do.

Phil.

Subject: error on using variables and matlab function within embedded func. simulink component

From: Niveen Morsi

Date: 12 Mar, 2013 07:43:08

Message: 8 of 8

"Phil Goddard" <phil@goddardconsulting.ca> wrote in message <khlusa$nf8$1@newscl01ah.mathworks.com>...
> I don't have any direct experience with aviinfo or aviread within a MATLAB Fcn block but suspect that because they return objects, and you need to call the methods (i.e. functions) that manipulate those objects you'd need to define all the methods as being eml.extrinsic too.
>
> Alternatively, you will most likely find it easier to write an m-code S-Function to do whatever you are trying to do.
>
> Phil.

thanks alot Phil..

but i don't konw how to write an m-code S-Function.. :((

one more question plzz..
do you 've any idea how to convert matlab code to vhdl..
i've been told that hdl coder do something like that but its drop downlist is dimmed with only one single choice which is "Navigate to code" although i've ensured that i'm having hdl coder by running this command "ver('hdlcoder')"

Niveen

Tags for this Thread

No tags are associated with 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