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:
Loading dynamically function: err_while_looking_up_function

Subject: Loading dynamically function: err_while_looking_up_function

From: kees de Kapper

Date: 17 Jul, 2013 09:26:19

Message: 1 of 5

Hi all,

I'm loading some functions dynamically using the "eval()" possibility. This works great in the Matlab-environment. However, it fails in the stand-alone-mode (although he functions are appended during compilation), returning the following error when "Output = eval('MyFun_Kees();']);

An error occurred while trying to determine whether "MyFun_Kees" is a function name.
MATLAB:err_while_looking_up_function

What is going wrong? Can somebody give a clue? I found some posts on the internet about this issue, but did not found a (proper) reply to that.

Many thanks in advance!

Kind regards,
Kees

Subject: Loading dynamically function: err_while_looking_up_function

From: Nasser M. Abbasi

Date: 17 Jul, 2013 09:40:48

Message: 2 of 5

On 7/17/2013 4:26 AM, kees de Kapper wrote:
> Hi all,
>
> I'm loading some functions dynamically using the "eval()" possibility.
>This works great in the Matlab-environment. However, it fails in the stand-alone-mode
>(although he functions are appended during compilation), returning the following error
> when "Output = eval('MyFun_Kees();']);
>
> An error occurred while trying to determine whether "MyFun_Kees" is a function name.
> MATLAB:err_while_looking_up_function
>
> What is going wrong? Can somebody give a clue? I found some posts on the internet about
>this issue, but did not found a (proper) reply to that.
>

something here about it:

http://www.mathworks.com/support/solutions/en/data/1-18UMQ/

and
"Why Avoid the eval Function?"

http://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html

Subject: Loading dynamically function: err_while_looking_up_function

From: kees de Kapper

Date: 17 Jul, 2013 13:33:08

Message: 3 of 5

Thank you Nasser for your reply.

Thirst, I became sad by your answer, but the links you mentioned gave me a way to overcome the problem. And I became happy again. I changed all the "eval" statements to "feval" which supposed to be a proper alternative.

Unfortunately I stuck into a "previously accessible file "MyFun_Kees" is now inaccessible"-error.
Then, I found out that this had to be with the use of "addpath" in a deployed/compiled version. However, removing the "addpath" gives an "Undefined function or variable" problem.

This brings me in a vicious circle (Please, help me out?!).

How can I tell Matlab to look into a folder for files/functions to execute/call?

Looking forward for a solution. Many thanks!

Kees.

"Nasser M. Abbasi" wrote in message <ks5oqv$g59$1@speranza.aioe.org>...
>
> something here about it:
>
> http://www.mathworks.com/support/solutions/en/data/1-18UMQ/
>
> and
> "Why Avoid the eval Function?"
>
> http://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html
>

Subject: Loading dynamically function: err_while_looking_up_function

From: Steven_Lord

Date: 17 Jul, 2013 14:09:43

Message: 4 of 5



"kees de Kapper" <kees_de_kapper@hotmail.com> wrote in message
news:ks66ek$knl$1@newscl01ah.mathworks.com...
> Thank you Nasser for your reply.
>
> Thirst, I became sad by your answer, but the links you mentioned gave me a
> way to overcome the problem. And I became happy again. I changed all the
> "eval" statements to "feval" which supposed to be a proper alternative.
>
> Unfortunately I stuck into a "previously accessible file "MyFun_Kees" is
> now inaccessible"-error. Then, I found out that this had to be with the
> use of "addpath" in a deployed/compiled version. However, removing the
> "addpath" gives an "Undefined function or variable" problem.
>
> This brings me in a vicious circle (Please, help me out?!).
> How can I tell Matlab to look into a folder for files/functions to
> execute/call?

All the functions that you want to execute in your compiled application must
be present and "visible" (either by being called directly from another
function [EVAL/FEVAL count as being called INdirectly], by being included
explicitly in the MCC call using the -a flag, or by being mentioned
explicitly using the %#function pragma in a function that is "visible") when
the application is compiled.

http://www.mathworks.com/help/compiler/mcc-command-arguments-listed-alphabetically.html

http://www.mathworks.com/help/compiler/function.html

You cannot add functions to your application at runtime.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Loading dynamically function: err_while_looking_up_function

From: kees de Kapper

Date: 17 Jul, 2013 20:00:16

Message: 5 of 5

Thank you Steve for replying. This part is very essential. But a pity as well.

>
> You cannot add functions to your application at runtime.
>

I will add them using the "-a"

Kind regards,
Kees

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