From: Matlabuser on 17 Mar 2010 06:56 Hi all, I am trying to write a function that would delete variables from the Base workspace. So far it's not working. "clear all" or "clear global" only deletes the variables defined in the function workspace. How can I clear variables from the Base workspace? The "help" section didn't really help... thanks
From: Husam Aldahiyat on 17 Mar 2010 07:25 "Matlabuser " <b.enis(a)laposte.net> wrote in message <hnqcg5$a7e$1(a)fred.mathworks.com>... > Hi all, > > I am trying to write a function that would delete variables from the Base workspace. > So far it's not working. > "clear all" or "clear global" only deletes the variables defined in the function workspace. > > How can I clear variables from the Base workspace? > The "help" section didn't really help... > > thanks >> evalin('base','clear all') Or >> evalin('base','clear x y')
From: Rune Allnor on 17 Mar 2010 07:29 On 17 Mar, 11:56, "Matlabuser " <b.e...(a)laposte.net> wrote: > Hi all, > > I am trying to write a function that would delete variables from the Base workspace. > So far it's not working. > "clear all" or "clear global" only deletes the variables defined in the function workspace. > > How can I clear variables from the Base workspace? > The "help" section didn't really help... > > thanks There is no reason why a function should have access to the main workspace. The whole rational behind functions is to set up a local workspace, that is independent from the main workspace, except for input / return arguments. If you are *sure* you want to let a program get access to the main workspace - and it's a very bad idea - use a script that is called from the main workspace. Again: There are *very* good reasons why what you want to do is not easy. It is almost ceratinly not the correct way of doing whatever it is you are up to. Rune
|
Pages: 1 Prev: reading a plot (getting a matrix of a plot) Next: Striped image: automatic rubber band box? |