<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Clearing the Air</title>
	<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/</link>
	<description>Loren Shure  works on design of the MATLAB language at &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62;. She writes here about once a week on MATLAB programming and related topics. &#60;br&#62;&#60;br&#62;&#60;a href="/images/loren-full.jpg"&#62;&#60;img src="/images/loren.jpg"&#62;&#60;/a&#62;</description>
	<pubDate>Sun, 08 Nov 2009 05:32:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29917</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Thu, 04 Dec 2008 17:13:34 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29917</guid>
		<description>John-

There are at least 2 ways to get the data to the base workspace besides the load/save method.  First, and highly encouraged, is to return the variables as outputs from the function.  Second possibility, which I prefer less, is to have your function issue some assignin statements to the base workspace and get your function variables to POOF (as Steve Lord says) the data into the base workspace.

--Loren</description>
		<content:encoded><![CDATA[<p>John-</p>
<p>There are at least 2 ways to get the data to the base workspace besides the load/save method.  First, and highly encouraged, is to return the variables as outputs from the function.  Second possibility, which I prefer less, is to have your function issue some assignin statements to the base workspace and get your function variables to POOF (as Steve Lord says) the data into the base workspace.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29916</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 04 Dec 2008 17:00:19 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29916</guid>
		<description>Jorgen, Loren,

I have tried using Jorgen's approach, but this approach has also frustrated me because I can't do it in core memory.  You have to save variables to a file and then back in the root workspace reload them.  This isn't reasonable if the variables take much memory.  Besides, I don't like having to type "load foo" every time.  And I don't like creating unnecessary .mat files.  Isn't there any way to simply set the variables from a function directly into Matlab's root workspace?

Thanks, John</description>
		<content:encoded><![CDATA[<p>Jorgen, Loren,</p>
<p>I have tried using Jorgen&#8217;s approach, but this approach has also frustrated me because I can&#8217;t do it in core memory.  You have to save variables to a file and then back in the root workspace reload them.  This isn&#8217;t reasonable if the variables take much memory.  Besides, I don&#8217;t like having to type &#8220;load foo&#8221; every time.  And I don&#8217;t like creating unnecessary .mat files.  Isn&#8217;t there any way to simply set the variables from a function directly into Matlab&#8217;s root workspace?</p>
<p>Thanks, John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29527</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Thu, 19 Jun 2008 19:20:50 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29527</guid>
		<description>Vittorio-

What exactly do you mean about using clear in batch and it not working?

clear should clear the memory from MATLAB, enabling MATLAB to use that memory again, if required.  I believe the memory does not get returned to the operating system until you quit MATLAB because of how the underlying memory managers work.  It behaves differently on Windows.

--Loren</description>
		<content:encoded><![CDATA[<p>Vittorio-</p>
<p>What exactly do you mean about using clear in batch and it not working?</p>
<p>clear should clear the memory from MATLAB, enabling MATLAB to use that memory again, if required.  I believe the memory does not get returned to the operating system until you quit MATLAB because of how the underlying memory managers work.  It behaves differently on Windows.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vittorio</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29526</link>
		<dc:creator>Vittorio</dc:creator>
		<pubDate>Thu, 19 Jun 2008 16:06:19 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29526</guid>
		<description>Loren,
in Solaris environment (and I suspect in Linux too), in batch execution the statement clear does not work. Is there a turnaround to free memory in Unix from a matlab script?

regards</description>
		<content:encoded><![CDATA[<p>Loren,<br />
in Solaris environment (and I suspect in Linux too), in batch execution the statement clear does not work. Is there a turnaround to free memory in Unix from a matlab script?</p>
<p>regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorgen Harmse</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29343</link>
		<dc:creator>Jorgen Harmse</dc:creator>
		<pubDate>Thu, 29 May 2008 14:56:51 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29343</guid>
		<description>I don't quite see what Neill &#38; Robert are trying to do. If I want a 'clean slate', I write a function, unless I also need to recover memory. The variables created in the function can even be returned.

function S = foo

% Perform calculations, etc.

% Remove loop control variables and other clutter,
% perhaps with clearvars -except.

save fooTemp.mat;
S = load('fooTemp.mat');
delete fooTemp.mat;
% There might be a clean way to do this in core memory,
% but the only way I know involves repeated eval calls.
return;</description>
		<content:encoded><![CDATA[<p>I don&#8217;t quite see what Neill &amp; Robert are trying to do. If I want a &#8216;clean slate&#8217;, I write a function, unless I also need to recover memory. The variables created in the function can even be returned.</p>
<p>function S = foo</p>
<p>% Perform calculations, etc.</p>
<p>% Remove loop control variables and other clutter,<br />
% perhaps with clearvars -except.</p>
<p>save fooTemp.mat;<br />
S = load(&#8217;fooTemp.mat&#8217;);<br />
delete fooTemp.mat;<br />
% There might be a clean way to do this in core memory,<br />
% but the only way I know involves repeated eval calls.<br />
return;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29176</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 20 May 2008 13:19:39 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29176</guid>
		<description>Jon-

I will put the request in and you can too:

http://www.mathworks.com/support/service_requests/contact_support.do

--Loren</description>
		<content:encoded><![CDATA[<p>Jon-</p>
<p>I will put the request in and you can too:</p>
<p><a href="http://www.mathworks.com/support/service_requests/contact_support.do" rel="nofollow">http://www.mathworks.com/support/service_requests/contact_support.do</a></p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jon</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29174</link>
		<dc:creator>jon</dc:creator>
		<pubDate>Tue, 20 May 2008 12:55:57 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29174</guid>
		<description>Concerning the debug gotcha. I have been annoyed by this for years. Could you please request that the developers provide an option for example clear -exceptbreak, to at least be able to selectively turn this feature off. Even better, since I rarely want break points cleared out when issuing the clear command, it would be great if I could set the default behavior in my preferences to leave break points. Note if I want to clear out all break points I can do this within the debugger</description>
		<content:encoded><![CDATA[<p>Concerning the debug gotcha. I have been annoyed by this for years. Could you please request that the developers provide an option for example clear -exceptbreak, to at least be able to selectively turn this feature off. Even better, since I rarely want break points cleared out when issuing the clear command, it would be great if I could set the default behavior in my preferences to leave break points. Note if I want to clear out all break points I can do this within the debugger</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29159</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 19 May 2008 17:57:50 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29159</guid>
		<description>Robert-

Nice suggestion.

--Loren</description>
		<content:encoded><![CDATA[<p>Robert-</p>
<p>Nice suggestion.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Adams</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29158</link>
		<dc:creator>Robert Adams</dc:creator>
		<pubDate>Mon, 19 May 2008 17:33:21 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29158</guid>
		<description>Neill, Loren

I use the following in some of my scripts to check if any breakpoints are set.

s = dbstatus;

if (isempty(s))
   clear all
else
   fprintf('\n\n  Debug stop set\n  Using "clear variables" instead of "clear all"\n\n');

   clear variables
end

Not a perfect solution but at least I can debug, and start with no defined variables.</description>
		<content:encoded><![CDATA[<p>Neill, Loren</p>
<p>I use the following in some of my scripts to check if any breakpoints are set.</p>
<p>s = dbstatus;</p>
<p>if (isempty(s))<br />
   clear all<br />
else<br />
   fprintf(&#8217;\n\n  Debug stop set\n  Using &#8220;clear variables&#8221; instead of &#8220;clear all&#8221;\n\n&#8217;);</p>
<p>   clear variables<br />
end</p>
<p>Not a perfect solution but at least I can debug, and start with no defined variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29110</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Fri, 16 May 2008 15:23:57 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/04/08/clearing-the-air/#comment-29110</guid>
		<description>Neill-

Use clear variables or clearvars with names, and then separately clear the functions you want to clear by name, e.g., clear foobar.  Otherwise, you will clear all functions, including the one you are debugging, and it will lose it's breakpoints.

--Loren</description>
		<content:encoded><![CDATA[<p>Neill-</p>
<p>Use clear variables or clearvars with names, and then separately clear the functions you want to clear by name, e.g., clear foobar.  Otherwise, you will clear all functions, including the one you are debugging, and it will lose it&#8217;s breakpoints.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
</channel>
</rss>
