Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems using embedded matlab function

93 views
Skip to first unread message

ABBAS

unread,
Sep 24, 2007, 9:29:13 AM9/24/07
to
Hi every body,

In my embedded Matlab Function where i programmed with
matlab R2006b. I have the following problem:
When i run it in normal mode, all is ok, but when i do it
in external mode (real time) i get error message like:

1- Failed to eliminate a use of the MATLAB
function 'bin2dec'.
For non-simulation builds, uses of unsupported MATLAB
functions are eliminated if they do not effect the function
outputs.

or:
2- Failed to eliminate a use of the MATLAB
function 'num2str'.
For non-simulation builds, uses of unsupported MATLAB
functions are eliminated if they do not effect the function
outputs.

I do not understand why! May be some setting or simulation
parameters are wrong !!

thanks in advance for your help
PS: Sorry for my english

Praetorian

unread,
Sep 24, 2007, 12:19:17 PM9/24/07
to

Abbas,
The problem is that neither of those functions, BIN2DEC or NUM2STR,
are supported by Embedded Matlab for code generation. Search Matlab
help for "Embedded MATLAB Run-Time Function Library" for a list of
supported functions.

HTH,
Ashish.

berberat

unread,
Sep 25, 2007, 3:45:41 AM9/25/07
to
> Abbas,
> The problem is that neither of those functions, BIN2DEC
or NUM2STR,
> are supported by Embedded Matlab for code generation.
Search Matlab
> help for "Embedded MATLAB Run-Time Function Library" for
a list of
> supported functions.
>
> HTH,
> Ashish.
>
Thanks for your answer,

I just tell you that i used both eml.extrinsic
('bin2dec','num2str') and feval, with out success ! Is
there an other way to declare these functions or do i have
simply to try some other function ? But which one ?

ABBAS

Michael Hosea

unread,
Sep 25, 2007, 12:30:28 PM9/25/07
to
What you are doing is calling out to MATLAB to evaluate the extrinsic
functions, BIN2DEC and NUM2STR. That works fine in simulation because
MATLAB is there to call. However, for code generation we cannot assume that
MATLAB is there to call, so BIN2DEC and NUM2STR need to be translated into
C. That's the whole point of being a supported in the Embedded MATLAB
Run-Time Function Library. At this time, BIN2DEC and NUM2STR are not
supported, and no configuration trick will make these work for code
generation. You will need to supply your own subfunctions that meet your
requirements for these operations. For example, the core of BIN2DEC for a
simple 1xn array of '0' and '1' characters S is

x = sum((S - '0').*pow2(length(S)-1:-1:0));

NUM2STR is harder. For this I might try eml.ceval('sprintf',...), but there
are the matters of removing the null terminator and managing the what would
normally be a variable length output as one of fixed length (Embedded MATLAB
doesn't support variable size arrays).
--
Mike

"berberat " <tab...@yahoo.fr> wrote in message
news:fdaeb5$78m$1...@fred.mathworks.com...

berberat

unread,
Sep 26, 2007, 4:14:36 AM9/26/07
to
Hi Mike,
thanks for you help, i'm looking in the Embedded Matlab Run-
Time Function Library to find supported function according
to my neeeds.

berberat

Michael Hosea

unread,
Sep 26, 2007, 11:55:27 AM9/26/07
to
I'm not sure what you're trying to do, but we don't support many
string-related functions. We do have bitset, bitget, bitshift, bitand,
bitor, bitxor, typecast, and unsigned integer types if you want to work with
an unsigned integer's binary representation "directly", i.e. without
converting to a string.

I do take "requests". Somebody asked for typecast here, and I got it into
the next release. Please understand that there are some things I cannot do
yet (e.g. FIND) because we don't have dynamic sizing, and big, complicated
functions cannot be done so quickly.
--
Mike

"berberat " <tab...@yahoo.fr> wrote in message

news:fdd4dc$6e0$1...@fred.mathworks.com...

artdhita

unread,
Jul 7, 2008, 11:53:01 PM7/7/08
to
"Michael Hosea" <mho...@mathworks.com> wrote in message
<fddvdf$18o$1...@fred.mathworks.com>...

Hi, everyone...
I am the beginner in matlab..
I need to use matlab to make the simulation of my machine..
I have made the modelling and i want to try in simulink, is
my modelling correct or not? (i will see the result by the
graph).
I used the Embedded Matlab Fcn block to put my formula into
the simulink. But, when I want to run the simulink, there is
the interruption window that said
&#8220;Error using ==> stateflow\private\slsf
Error using ==> stateflow\private\autobuild_kernel
Error using ==> stateflow\private\targetman
Error using ==> cd
Cannot CD to C:\Program Files\MATLAB71\work\sfprj\ (Name is
nonexistent or not a directory).&#8221;

I don&#8217;t know what should I do with this condition..I am
really glad with your helping answer...
Thank you very much for all of your help, everyone..
-Sarah-

>

0 new messages