<?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: What&#8217;s the Big deal?</title>
	<atom:link href="http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/</link>
	<description>Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Oliver Woodford</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30183</link>
		<dc:creator>Oliver Woodford</dc:creator>
		<pubDate>Fri, 03 Apr 2009 14:38:50 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30183</guid>
		<description>Hoi Wong: Note that the A and B that you generate are different. The deal method initializes every cell in A with zeros(140). To do this using the num2cell method you should do:
&gt;&gt; tic, B=squeeze(num2cell(zeros(140,140,140,140),1:2)); toc
??? Error using ==&gt; zeros
Out of memory. Type HELP MEMORY for your options.

However, to replicate what you did using num2cell (initializing every cell to 0) using deal, I would do:
&gt;&gt; tic, A=cell(140); [A{:}]=deal(0); toc
Elapsed time is 1.740839 seconds.
&gt;&gt; tic, B=num2cell(zeros(140)); toc
Elapsed time is 0.012501 seconds.

So your query about turning cells into comma separated lists is still valid.

Oliver</description>
		<content:encoded><![CDATA[<p>Hoi Wong: Note that the A and B that you generate are different. The deal method initializes every cell in A with zeros(140). To do this using the num2cell method you should do:<br />
&gt;&gt; tic, B=squeeze(num2cell(zeros(140,140,140,140),1:2)); toc<br />
??? Error using ==&gt; zeros<br />
Out of memory. Type HELP MEMORY for your options.</p>
<p>However, to replicate what you did using num2cell (initializing every cell to 0) using deal, I would do:<br />
&gt;&gt; tic, A=cell(140); [A{:}]=deal(0); toc<br />
Elapsed time is 1.740839 seconds.<br />
&gt;&gt; tic, B=num2cell(zeros(140)); toc<br />
Elapsed time is 0.012501 seconds.</p>
<p>So your query about turning cells into comma separated lists is still valid.</p>
<p>Oliver</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoi Wong</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30175</link>
		<dc:creator>Hoi Wong</dc:creator>
		<pubDate>Thu, 02 Apr 2009 09:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30175</guid>
		<description>Hi Oliver,

Very slick idea, and I was tempted to use it myself for large data set, but I have to do a performance test first:

&gt;&gt; tic, A=cell(140); [A{:}]=deal(zeros(140)); toc
Elapsed time is 0.936412 seconds.
&gt;&gt; tic, B=cell(140); B=num2cell(zeros(140)); toc
Elapsed time is 0.008790 seconds.

Loren: can you comment on the performance of unpacking cells into comma separated lists? It&#039;s a handy tool, but I&#039;m a little concerned that overusing it can lead to slow performance.</description>
		<content:encoded><![CDATA[<p>Hi Oliver,</p>
<p>Very slick idea, and I was tempted to use it myself for large data set, but I have to do a performance test first:</p>
<p>&gt;&gt; tic, A=cell(140); [A{:}]=deal(zeros(140)); toc<br />
Elapsed time is 0.936412 seconds.<br />
&gt;&gt; tic, B=cell(140); B=num2cell(zeros(140)); toc<br />
Elapsed time is 0.008790 seconds.</p>
<p>Loren: can you comment on the performance of unpacking cells into comma separated lists? It&#8217;s a handy tool, but I&#8217;m a little concerned that overusing it can lead to slow performance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver Woodford</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30162</link>
		<dc:creator>Oliver Woodford</dc:creator>
		<pubDate>Wed, 01 Apr 2009 11:12:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30162</guid>
		<description>Sometimes I use deal to initialize the cells of a cell array. E.g.
A = cell(2,3);
[A{:}] = deal(zeros(3));</description>
		<content:encoded><![CDATA[<p>Sometimes I use deal to initialize the cells of a cell array. E.g.<br />
A = cell(2,3);<br />
[A{:}] = deal(zeros(3));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoi Wong</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30158</link>
		<dc:creator>Hoi Wong</dc:creator>
		<pubDate>Mon, 30 Mar 2009 19:14:34 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30158</guid>
		<description>I haven&#039;t thought I&#039;d end up using struct2vars() myself, but it just happened today when I&#039;m trying to cache all the needed variables in a struct inside appdata(0) and release them back into workspace. 

Because I want variable transparency in my code, I&#039;m reluctant to use assigin, and here&#039;s a complete usage of struct2vars:

variableNames = fieldnames(S);
[variableNames{:}]=struct2vars(S);

With that, I don&#039;t even have to keep track of the order of the variable names.</description>
		<content:encoded><![CDATA[<p>I haven&#8217;t thought I&#8217;d end up using struct2vars() myself, but it just happened today when I&#8217;m trying to cache all the needed variables in a struct inside appdata(0) and release them back into workspace. </p>
<p>Because I want variable transparency in my code, I&#8217;m reluctant to use assigin, and here&#8217;s a complete usage of struct2vars:</p>
<p>variableNames = fieldnames(S);<br />
[variableNames{:}]=struct2vars(S);</p>
<p>With that, I don&#8217;t even have to keep track of the order of the variable names.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30121</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 16 Mar 2009 15:47:10 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30121</guid>
		<description>Hoi Wong-

At the moment, MATLAB doesn&#039;t allow indexing into temporary variables.  They must be assigned first.  We have the enhancement suggestion on the books, but I have no timeline for introducing the feature.

--Loren</description>
		<content:encoded><![CDATA[<p>Hoi Wong-</p>
<p>At the moment, MATLAB doesn&#8217;t allow indexing into temporary variables.  They must be assigned first.  We have the enhancement suggestion on the books, but I have no timeline for introducing the feature.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoi Wong</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30120</link>
		<dc:creator>Hoi Wong</dc:creator>
		<pubDate>Sun, 15 Mar 2009 23:50:08 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30120</guid>
		<description>Hi Loren, after another user suggested using

C = struct2cell(S) ; [a,b,c] = deal(C{:})

to replace struct2vars(), I have another question for you: is there any reason why MATLAB doesn&#039;t allow something this?

[a, b, c]=(struct2cell(S)){:}

In other words, if it makes sense to say C=magic(2)+rand(2) [plus() operator], why can&#039;t I say (magic(2))(:,2) or (magic(2)){:,2} [subsref() operator]?</description>
		<content:encoded><![CDATA[<p>Hi Loren, after another user suggested using</p>
<p>C = struct2cell(S) ; [a,b,c] = deal(C{:})</p>
<p>to replace struct2vars(), I have another question for you: is there any reason why MATLAB doesn&#8217;t allow something this?</p>
<p>[a, b, c]=(struct2cell(S)){:}</p>
<p>In other words, if it makes sense to say C=magic(2)+rand(2) [plus() operator], why can&#8217;t I say (magic(2))(:,2) or (magic(2)){:,2} [subsref() operator]?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30105</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 11 Mar 2009 11:43:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30105</guid>
		<description>Hoi-

Thanks for code for Kled.  We have the enhancement requested logged to create a way to dump unwanted outputs.  Nothing like this is yet in a shipping MATLAB, including R2009a which is now out.

--Loren</description>
		<content:encoded><![CDATA[<p>Hoi-</p>
<p>Thanks for code for Kled.  We have the enhancement requested logged to create a way to dump unwanted outputs.  Nothing like this is yet in a shipping MATLAB, including R2009a which is now out.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoi Wong</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30104</link>
		<dc:creator>Hoi Wong</dc:creator>
		<pubDate>Wed, 11 Mar 2009 08:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30104</guid>
		<description>Regarding Kled&#039;s comment, here&#039;s the function to achieve this:

function varargout=struct2vars(S)
    C = struct2cell(S);
    varargout = {C{:}};
end

However, the output follows the ordering of your struct.</description>
		<content:encoded><![CDATA[<p>Regarding Kled&#8217;s comment, here&#8217;s the function to achieve this:</p>
<p>function varargout=struct2vars(S)<br />
    C = struct2cell(S);<br />
    varargout = {C{:}};<br />
end</p>
<p>However, the output follows the ordering of your struct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hoi Wong</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-30103</link>
		<dc:creator>Hoi Wong</dc:creator>
		<pubDate>Wed, 11 Mar 2009 08:16:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-30103</guid>
		<description>Hi Loren, regarding Oktay&#039;s proble, would you consider in future versions of MATLAB, create a &#039;dummy&#039; or &#039;unwanted&#039; class or keyword for people to dump unwanted output arguments into a black hole, and have MATLAB warn you when you are trying to reuse it? This will avoid a lot of sloppy code changes when a program is maintained by multiple people.</description>
		<content:encoded><![CDATA[<p>Hi Loren, regarding Oktay&#8217;s proble, would you consider in future versions of MATLAB, create a &#8216;dummy&#8217; or &#8216;unwanted&#8217; class or keyword for people to dump unwanted output arguments into a black hole, and have MATLAB warn you when you are trying to reuse it? This will avoid a lot of sloppy code changes when a program is maintained by multiple people.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/01/25/whats-the-big-deal/#comment-29564</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Thu, 03 Jul 2008 19:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=17#comment-29564</guid>
		<description>Oktay-

Depending what version of MATLAB you use, you shouldn&#039;t see the mlint warning (the later the version, the better for that).  

There is no way to ask for just the 2nd output, so you can&#039;t do what you want in a single statement unless you make your own function to index into outputs and grab the one you want with an extra function wrapped around the function f you are calling.

We have it as an enhancement in our feature database to allow skipping assignment to earlier output variables. 

Today some people suggest doing something like this.

&lt;pre&gt;
[B,B] = f(...)
&lt;/pre&gt;

so B gets overwritten.  I don&#039;t care for that as it assumes behavior of MATLAB (left-to-right) that we never wrote down and documented so could conceivably change it should that allow something new to be possible where it wouldn&#039;t otherwise.

--Loren</description>
		<content:encoded><![CDATA[<p>Oktay-</p>
<p>Depending what version of MATLAB you use, you shouldn&#8217;t see the mlint warning (the later the version, the better for that).  </p>
<p>There is no way to ask for just the 2nd output, so you can&#8217;t do what you want in a single statement unless you make your own function to index into outputs and grab the one you want with an extra function wrapped around the function f you are calling.</p>
<p>We have it as an enhancement in our feature database to allow skipping assignment to earlier output variables. </p>
<p>Today some people suggest doing something like this.</p>
<pre>
[B,B] = f(...)
</pre>
<p>so B gets overwritten.  I don&#8217;t care for that as it assumes behavior of MATLAB (left-to-right) that we never wrote down and documented so could conceivably change it should that allow something new to be possible where it wouldn&#8217;t otherwise.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
</channel>
</rss>

