Thread Subject: evaluating expressions obtained from UI. eval alternative

Subject: evaluating expressions obtained from UI. eval alternative

From: Ilya

Date: 15 Mar, 2008 04:00:38

Message: 1 of 5

I often write user interfaces that require user to input
analytical functions into edit boxes.
But I haven't found a MATLAB function specificially designed
to handle the scenario.

I tried different ways to acoomplish this:
1. I tried the subs function from symbolic math toolbox -
it's roubust, but is veeeery slow ((

2. Now I use eval. But it requires users to input
expressions using non-matrix operators like .+ .* etc.
Moreover, eval is not robust at all: users are able to
execute almost any MATLAB command inside my UI. Yet, eval is
not as fast as I want.

Any suggestions?
TIA

Subject: evaluating expressions obtained from UI. eval alternative

From: Dan Haeg

Date: 15 Mar, 2008 18:39:05

Message: 2 of 5

"Ilya " <ilyapoz@gmail.com> wrote in message
<frfhl6$6ov$1@fred.mathworks.com>...
> I often write user interfaces that require user to input
> analytical functions into edit boxes.
> But I haven't found a MATLAB function specificially designed
> to handle the scenario.
>
> I tried different ways to acoomplish this:
> 1. I tried the subs function from symbolic math toolbox -
> it's roubust, but is veeeery slow ((
>
> 2. Now I use eval. But it requires users to input
> expressions using non-matrix operators like .+ .* etc.
> Moreover, eval is not robust at all: users are able to
> execute almost any MATLAB command inside my UI. Yet, eval is
> not as fast as I want.
>
> Any suggestions?
> TIA
>

could you use inline?

Subject: evaluating expressions obtained from UI. eval alternative

From: Arthur G

Date: 15 Mar, 2008 19:32:14

Message: 3 of 5

On 2008-03-15 14:39:05 -0400, "Dan Haeg" <haegd@msoe.edu> said:

> "Ilya " <ilyapoz@gmail.com> wrote in message
> <frfhl6$6ov$1@fred.mathworks.com>...
>> I often write user interfaces that require user to input
>> analytical functions into edit boxes.
>> But I haven't found a MATLAB function specificially designed
>> to handle the scenario.
>>
>> I tried different ways to acoomplish this:
>> 1. I tried the subs function from symbolic math toolbox -
>> it's roubust, but is veeeery slow ((
>>
>> 2. Now I use eval. But it requires users to input
>> expressions using non-matrix operators like .+ .* etc.
>> Moreover, eval is not robust at all: users are able to
>> execute almost any MATLAB command inside my UI. Yet, eval is
>> not as fast as I want.
>>
>> Any suggestions?
>> TIA
>>
>
> could you use inline?

Also, you might find the "vectorize" function helpful. It will take a
string or inline function and convert operations like "*" into ".*".

Subject: evaluating expressions obtained from UI. eval alternative

From: Ilya

Date: 15 Mar, 2008 20:14:01

Message: 4 of 5

> > could you use inline?
>
> Also, you might find the "vectorize" function helpful. It
will take a
> string or inline function and convert operations like "*"
into ".*".

Thank you very much! Wonder, why I haven't heard anything
about the "inline" func ((

Subject: evaluating expressions obtained from UI. eval alternative

From: Ilya

Date: 15 Mar, 2008 20:42:04

Message: 5 of 5

> could you use inline?
Well, according to the profiler, inline is even slower than
eval.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com