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

matlab compiler and evaluating a m-file that is known only at runtime

2 views
Skip to first unread message

Hannes Rieser

unread,
Nov 15, 2006, 4:41:19 AM11/15/06
to
hello all,
i want to generate a standalone executable of some matlab main code
with the matlab compiler. Unfortunately this matlab code uses an
additional m-file (in which a lot of complex data is stored directly
as a matlab object) that is only known at runtime and NOT at compile
time.
My idea was, that this m-file is passed as argument to the executable
and then evaluated by the main code via the feval or eval function.
This works inside of matlab but not with the compiled code. there was
always an "undefined function" error at runtime.

So my questions is:
Is there a way to evaluate by matlab-compiled standalone executable
code an m-file that is only known at runtime (and not at compile
time)? Or is this impossible in principle?

Thanks
Hannes

Emil

unread,
Oct 4, 2007, 11:32:32 PM10/4/07
to
Hi there,

I have similar needs - want to pass as argument .m file
creted by Simulink.Bus.save() to stand-alone (MATLAB
Compiler), process it and use its return result which is
cell array decribing Simulink.Bus objects. I use them to
generate Embeded Matlab code and then compile it to C by
emlc (2007b).
Did you find solution? Any thouths?

Thanks,
Emil

"Hannes Rieser" <hannes...@datacon.at> wrote in
message <ef460...@webcrossing.raydaftYaTP>...

Michael Liu

unread,
Oct 5, 2007, 12:00:08 AM10/5/07
to
I have similar problem too. I tried to generate m file under
"application name_mcr" directory. In this way, the
executable file can find new-generated m file. But this m
file is not processed by "mcc" command so the new error
message comes out as follows" The matlab file does not have
proper version information and may be corrupt".

I was hoping someone else will come out a solution for this.

Thanks,


"Hannes Rieser" <hannes...@datacon.at> wrote in message
<ef460...@webcrossing.raydaftYaTP>...

Michael Liu

unread,
Oct 24, 2007, 1:40:55 PM10/24/07
to
Hi
After a month of searching and testing, I have come out of
several solutions for this kind of problem.

i) Use "inline" function to define right hand side function
defined in m file.

ii) Use "nested" function.

However, these two methods are not computational efficient
ways if you have to call the user-defined function file
recursively since they are using eval command to evaluation
expression in string format.

So the best way is to rewrite associated command in another
language such as c or c++ and compile it to matlab-readable dll.

Thanks,
Gang


"Hannes Rieser" <hannes...@datacon.at> wrote in message
<ef460...@webcrossing.raydaftYaTP>...

0 new messages