From: TideMan on
On Feb 19, 2:08 pm, AMK <kennas...(a)gmail.com> wrote:
> So obviously that will work, but I didn't know you couldn't (or the reason why)you can't clear workspace variables from within a function.

Well, of course.
They only exist in the function where you created them.
This seems patently obvious to me.
It seems that you lack a basic understanding of how functions work.
Maybe you need to find a good textbook and read up about all this.
From: ImageAnalyst on
On Feb 18, 8:08 pm, AMK <kennas...(a)gmail.com> wrote:
> So obviously that will work, but I didn't know you couldn't (or the reason why)you can't clear workspace variables from within a function.

----------------------------------------
It will work if both of your m-files are just simple scripts - no line
in them that says "function foo()" or whatever. Otherwise the
variables live only inside the function and only when the function is
actually executing, and other functions can't (normally) see other
functions' variables.
From: AMK on
You're right, my matlab library consists of a vast array of "scripts". Horrible coding habit.
From: AMK on
Typically, all I write are scrips and not function foos(). Thus, with my first actual well functioning function foo(), I was surprised to see this behavior. Thanks - I'm reading now.