<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Renaming Variables</title>
	<atom:link href="http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:12:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Sander</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-13623</link>
		<dc:creator>Sander</dc:creator>
		<pubDate>Fri, 25 Jun 2010 06:54:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-13623</guid>
		<description>How can I get the RENVAR function at the moment?</description>
		<content:encoded><![CDATA[<p>How can I get the RENVAR function at the moment?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jiro</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-11259</link>
		<dc:creator>jiro</dc:creator>
		<pubDate>Fri, 16 May 2008 02:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-11259</guid>
		<description>jinshan,

This is off-topic, and I don&#039;t have an answer for you.

I suggest you take a look at the documentation for the functions you are interested in. If you have specific questions, you can post your questions on the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/&quot; rel=&quot;nofollow&quot;&gt;newsgroup&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>jinshan,</p>
<p>This is off-topic, and I don&#8217;t have an answer for you.</p>
<p>I suggest you take a look at the documentation for the functions you are interested in. If you have specific questions, you can post your questions on the <a href="http://www.mathworks.com/matlabcentral/newsreader/" rel="nofollow">newsgroup</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jinshan Xu</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-11229</link>
		<dc:creator>jinshan Xu</dc:creator>
		<pubDate>Thu, 15 May 2008 11:17:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-11229</guid>
		<description>dear professor:
   I am a student of a university. I do not know how to calculate the multi-dimensional fast fourier transform using fftn funcion.   I want to know that whether &quot; fftn(rand(2,2,3)) &quot;can give me the results of 3 dimensional fourier transform?</description>
		<content:encoded><![CDATA[<p>dear professor:<br />
   I am a student of a university. I do not know how to calculate the multi-dimensional fast fourier transform using fftn funcion.   I want to know that whether &#8221; fftn(rand(2,2,3)) &#8220;can give me the results of 3 dimensional fourier transform?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jiro</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10900</link>
		<dc:creator>jiro</dc:creator>
		<pubDate>Wed, 23 Apr 2008 04:50:06 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10900</guid>
		<description>Thanks everyone for your one (few)-liners.

Markus, I like your &quot;yesnoinput&quot; and &quot;yesnodialog&quot;. These interface functions (input, questdlg, etc) are already easy to use, but by creating wrapper functions, it makes them even more user-friendly.

Eric, I also have my own &quot;ccc&quot; command which does all of that. I use &quot;close all force&quot; for my closing function

Luca, nice use of MATLAB to give you what you want! MATLAB has its way of returning the results, and you have your way, and they may not always be the same. But with this, everyone&#039;s happy!</description>
		<content:encoded><![CDATA[<p>Thanks everyone for your one (few)-liners.</p>
<p>Markus, I like your &#8220;yesnoinput&#8221; and &#8220;yesnodialog&#8221;. These interface functions (input, questdlg, etc) are already easy to use, but by creating wrapper functions, it makes them even more user-friendly.</p>
<p>Eric, I also have my own &#8220;ccc&#8221; command which does all of that. I use &#8220;close all force&#8221; for my closing function</p>
<p>Luca, nice use of MATLAB to give you what you want! MATLAB has its way of returning the results, and you have your way, and they may not always be the same. But with this, everyone&#8217;s happy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luca Balbi</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10893</link>
		<dc:creator>Luca Balbi</dc:creator>
		<pubDate>Tue, 22 Apr 2008 13:56:45 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10893</guid>
		<description>I always work with magnitude of FFTs, and due to how MATLAB organizes data in the FFT, I created this wonderful one-liner:

function img = magFFT2(kspace)
img = abs(fftshift(fftn(fftshift(kspace))));
end</description>
		<content:encoded><![CDATA[<p>I always work with magnitude of FFTs, and due to how MATLAB organizes data in the FFT, I created this wonderful one-liner:</p>
<p>function img = magFFT2(kspace)<br />
img = abs(fftshift(fftn(fftshift(kspace))));<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric M</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10867</link>
		<dc:creator>Eric M</dc:creator>
		<pubDate>Mon, 21 Apr 2008 12:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10867</guid>
		<description>Here is one I use very frequently

script ccc
%
clear all
delete(allchild(0)) % stronger than close all
clc</description>
		<content:encoded><![CDATA[<p>Here is one I use very frequently</p>
<p>script ccc<br />
%<br />
clear all<br />
delete(allchild(0)) % stronger than close all<br />
clc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10851</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Sun, 20 Apr 2008 21:41:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10851</guid>
		<description>Hi Doug, I guess everyone uses few-liners. Here are some of mine. Nothing worth to put on Matlab Central, but you asked for it...

Regards
Markus

function fileSize = getfilesize(fileName)

dirStruct = dir(fileName);
if ~isempty(dirStruct)
  fileSize = dirStruct.bytes;
else
  fileSize = [];
end


function filename = chomppath(str)
%CHOMPPATH  Return file name wihtout path.

str = strrep(str, &#039;\&#039;, &#039;/&#039;);
[pathname, filename, extension] = fileparts(str); %#ok
filename = [filename extension];


function str = concatpath(varargin)
%CONCATPATH  Concatenate file parts with correct file separator.

str = &#039;&#039;;
for n=1:nargin
  curStr = varargin{n};
  str = fullfile(str, chompsep(curStr));
end
str = strrep(str, &#039;\&#039;, &#039;/&#039;);


function nowinseconds = mbtime
%MBTIME  Return serial date number converted to seconds

% function datenummx is a mex-file found in toolbox/matlab/timefun
nowinseconds = datenummx(clock)*86400;


function deleteallwaitbars
%DELETEALLWAITBARS  Delete all existing waitbars.

curShowHiddenHandles = get(0, &#039;ShowHiddenHandles&#039;);
set(0, &#039;ShowHiddenHandles&#039;, &#039;on&#039;);
ch = get(0, &#039;Children&#039;);
for k = 1:length(ch)
	if  strcmp(get(ch(k), &#039;Type&#039;), &#039;figure&#039;) &amp;&amp; ...
			strcmp(get(ch(k), &#039;Tag&#039;),  &#039;TMWWaitbar&#039;)
		delete(ch(k));
	end
end
set(0, &#039;ShowHiddenHandles&#039;, curShowHiddenHandles);


function deleteallfigures
%DELETEALLFIGURES  Delete all existing figues.

close all
close all hidden
drawnow
ch = get(0, &#039;Children&#039;);
for n=1:length(ch)
	if strcmp(get(ch(n), &#039;Type&#039;), &#039;figure&#039;)
		delete(ch(n));
	end
end
drawnow


function spyMatrix = cellspy(cellMatrix)
%CELLSPY   Return sparsity pattern for cell arrays.
%   Y = CELLSPY(X) returns a matrix of the same size as cell array X with
%   zeros at the positions of empty cells and ones for non-empty cells.

spyMatrix = ~cellfun(@isempty, cellMatrix);
if nargout == 0
  spy(spyMatrix);
  axis normal;
end


function check = yesnoinput(str)
%YESNOINPUT  Force user decision.
%		YESNOINPUT(STR) diplays string STR and waits for the user to type &#039;y&#039;
%		for yes or &#039;n&#039; for no. true is returned for yes and false for no.

while 1
	answer = input([str,&#039; (yes/no)\n&#039;],&#039;s&#039;);
	if ~isempty(answer)
		if strcmpi(answer, &#039;y&#039;) &#124;&#124; strcmpi(answer, &#039;yes&#039;)
			check  = true;
			return
		elseif strcmpi(answer, &#039;n&#039;) &#124;&#124; strcmpi(answer, &#039;no&#039;)
			check  = false;
			return
		end
	else
		disp(&#039;Incorrect input. Try again&#039;);
	end
end


function check = yesnodialog(question, windowtitle, defaultAnswer)
%YESNODIALOG Open window for user decision.

if ~exist(&#039;windowtitle&#039;, &#039;var&#039;) &#124;&#124; isempty(windowtitle)
	windowtitle = &#039;Question dialog&#039;;
end
if ~exist(&#039;defaultAnswer&#039;, &#039;var&#039;)
	defaultAnswer = &#039;yes&#039;;
end

while 1
	answer = questdlg(question,windowtitle,&#039;yes&#039;,&#039;no&#039;,defaultAnswer);
	switch answer
		case &#039;yes&#039;
			check  = true;
			return
		case &#039;no&#039;
			check  = false;
			return
	end
end



script profileon:

profile off
profile clear
profile on -detail builtin


script profilereport:

profile report
profile off</description>
		<content:encoded><![CDATA[<p>Hi Doug, I guess everyone uses few-liners. Here are some of mine. Nothing worth to put on Matlab Central, but you asked for it&#8230;</p>
<p>Regards<br />
Markus</p>
<p>function fileSize = getfilesize(fileName)</p>
<p>dirStruct = dir(fileName);<br />
if ~isempty(dirStruct)<br />
  fileSize = dirStruct.bytes;<br />
else<br />
  fileSize = [];<br />
end</p>
<p>function filename = chomppath(str)<br />
%CHOMPPATH  Return file name wihtout path.</p>
<p>str = strrep(str, &#8216;\&#8217;, &#8216;/&#8217;);<br />
[pathname, filename, extension] = fileparts(str); %#ok<br />
filename = [filename extension];</p>
<p>function str = concatpath(varargin)<br />
%CONCATPATH  Concatenate file parts with correct file separator.</p>
<p>str = &#8221;;<br />
for n=1:nargin<br />
  curStr = varargin{n};<br />
  str = fullfile(str, chompsep(curStr));<br />
end<br />
str = strrep(str, &#8216;\&#8217;, &#8216;/&#8217;);</p>
<p>function nowinseconds = mbtime<br />
%MBTIME  Return serial date number converted to seconds</p>
<p>% function datenummx is a mex-file found in toolbox/matlab/timefun<br />
nowinseconds = datenummx(clock)*86400;</p>
<p>function deleteallwaitbars<br />
%DELETEALLWAITBARS  Delete all existing waitbars.</p>
<p>curShowHiddenHandles = get(0, &#8216;ShowHiddenHandles&#8217;);<br />
set(0, &#8216;ShowHiddenHandles&#8217;, &#8216;on&#8217;);<br />
ch = get(0, &#8216;Children&#8217;);<br />
for k = 1:length(ch)<br />
	if  strcmp(get(ch(k), &#8216;Type&#8217;), &#8216;figure&#8217;) &amp;&amp; &#8230;<br />
			strcmp(get(ch(k), &#8216;Tag&#8217;),  &#8216;TMWWaitbar&#8217;)<br />
		delete(ch(k));<br />
	end<br />
end<br />
set(0, &#8216;ShowHiddenHandles&#8217;, curShowHiddenHandles);</p>
<p>function deleteallfigures<br />
%DELETEALLFIGURES  Delete all existing figues.</p>
<p>close all<br />
close all hidden<br />
drawnow<br />
ch = get(0, &#8216;Children&#8217;);<br />
for n=1:length(ch)<br />
	if strcmp(get(ch(n), &#8216;Type&#8217;), &#8216;figure&#8217;)<br />
		delete(ch(n));<br />
	end<br />
end<br />
drawnow</p>
<p>function spyMatrix = cellspy(cellMatrix)<br />
%CELLSPY   Return sparsity pattern for cell arrays.<br />
%   Y = CELLSPY(X) returns a matrix of the same size as cell array X with<br />
%   zeros at the positions of empty cells and ones for non-empty cells.</p>
<p>spyMatrix = ~cellfun(@isempty, cellMatrix);<br />
if nargout == 0<br />
  spy(spyMatrix);<br />
  axis normal;<br />
end</p>
<p>function check = yesnoinput(str)<br />
%YESNOINPUT  Force user decision.<br />
%		YESNOINPUT(STR) diplays string STR and waits for the user to type &#8216;y&#8217;<br />
%		for yes or &#8216;n&#8217; for no. true is returned for yes and false for no.</p>
<p>while 1<br />
	answer = input([str,' (yes/no)\n'],&#8217;s');<br />
	if ~isempty(answer)<br />
		if strcmpi(answer, &#8216;y&#8217;) || strcmpi(answer, &#8216;yes&#8217;)<br />
			check  = true;<br />
			return<br />
		elseif strcmpi(answer, &#8216;n&#8217;) || strcmpi(answer, &#8216;no&#8217;)<br />
			check  = false;<br />
			return<br />
		end<br />
	else<br />
		disp(&#8216;Incorrect input. Try again&#8217;);<br />
	end<br />
end</p>
<p>function check = yesnodialog(question, windowtitle, defaultAnswer)<br />
%YESNODIALOG Open window for user decision.</p>
<p>if ~exist(&#8216;windowtitle&#8217;, &#8216;var&#8217;) || isempty(windowtitle)<br />
	windowtitle = &#8216;Question dialog&#8217;;<br />
end<br />
if ~exist(&#8216;defaultAnswer&#8217;, &#8216;var&#8217;)<br />
	defaultAnswer = &#8216;yes&#8217;;<br />
end</p>
<p>while 1<br />
	answer = questdlg(question,windowtitle,&#8217;yes&#8217;,'no&#8217;,defaultAnswer);<br />
	switch answer<br />
		case &#8216;yes&#8217;<br />
			check  = true;<br />
			return<br />
		case &#8216;no&#8217;<br />
			check  = false;<br />
			return<br />
	end<br />
end</p>
<p>script profileon:</p>
<p>profile off<br />
profile clear<br />
profile on -detail builtin</p>
<p>script profilereport:</p>
<p>profile report<br />
profile off</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jiro</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10815</link>
		<dc:creator>jiro</dc:creator>
		<pubDate>Sat, 19 Apr 2008 03:23:58 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10815</guid>
		<description>Hi Quan,

There are couple of situations I can think of for lazy copying. One is when you are creating copies of variables:

&lt;code&gt;a = rand(1000);
b = a;
c = a;
&lt;/code&gt;

Although there are three 1000-by-1000 matrices, there&#039;s only one of them in memory. The other two are simply referencing the one. As soon as you modify the variables, then actual physical copies are made.

Another one is when you are passing a variable into a function. Even though a function has its own workspace, if the input variable being passed is only being referenced (not modified), it is not being copied (see the first example in Loren&#039;s post).</description>
		<content:encoded><![CDATA[<p>Hi Quan,</p>
<p>There are couple of situations I can think of for lazy copying. One is when you are creating copies of variables:</p>
<p><code>a = rand(1000);<br />
b = a;<br />
c = a;<br />
</code></p>
<p>Although there are three 1000-by-1000 matrices, there&#8217;s only one of them in memory. The other two are simply referencing the one. As soon as you modify the variables, then actual physical copies are made.</p>
<p>Another one is when you are passing a variable into a function. Even though a function has its own workspace, if the input variable being passed is only being referenced (not modified), it is not being copied (see the first example in Loren&#8217;s post).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quan</title>
		<link>http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10813</link>
		<dc:creator>Quan</dc:creator>
		<pubDate>Fri, 18 Apr 2008 23:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/04/18/renaming-variables/#comment-10813</guid>
		<description>Hello Jiro,

That was a nice,simple, and informative post.

When does lazy copying become a factor in practice? 

As far as nicknames, how does &quot;Dig Doug&quot; sound?  Or maybe &quot;Doug the Destroyer&quot;?  Or my personal favorite, &quot;Doug Diesal&quot;</description>
		<content:encoded><![CDATA[<p>Hello Jiro,</p>
<p>That was a nice,simple, and informative post.</p>
<p>When does lazy copying become a factor in practice? </p>
<p>As far as nicknames, how does &#8220;Dig Doug&#8221; sound?  Or maybe &#8220;Doug the Destroyer&#8221;?  Or my personal favorite, &#8220;Doug Diesal&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

