Thread Subject: evaluating expressions obtained from UI. eval alternative

Subject: evaluating expressions obtained from UI. eval alternative

From: Ilya

Date: 15 Mar, 2008 03:58:01

Message: 1 of 3

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: Loren Shure

Date: 18 Mar, 2008 12:30:16

Message: 2 of 3

In article <frfhg9$4of$1@fred.mathworks.com>, ilyapoz@gmail.com says...
> 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
>
>

Turn it into a function handle with str2func?

--
Loren
http://blogs.mathworks.com/loren/

Subject: evaluating expressions obtained from UI. eval alternative

From: Ilya

Date: 18 Mar, 2008 14:27:02

Message: 3 of 3

Loren Shure <loren@mathworks.com> wrote in message
> Turn it into a function handle with str2func?
This works only if there is just a function's name in the
string, but I need to allow user to input any expression.

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
eval subs evalu... Ilya 15 Mar, 2008 00:00:39
rssFeed for this Thread

Contact us at files@mathworks.com