<?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: Scalar Expansion and More</title>
	<atom:link href="http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/</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: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-30868</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 02 Dec 2009 21:08:11 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-30868</guid>
		<description>Per-

I recommend you send your example of what you would prefer as an enhancement request to technical support (link on the right of the page).  I think it&#039;s a good suggestion.

--Loren</description>
		<content:encoded><![CDATA[<p>Per-</p>
<p>I recommend you send your example of what you would prefer as an enhancement request to technical support (link on the right of the page).  I think it&#8217;s a good suggestion.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: per isakson</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-30867</link>
		<dc:creator>per isakson</dc:creator>
		<pubDate>Wed, 02 Dec 2009 20:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-30867</guid>
		<description>I want to excecute many different functions with the same input argument. The user selects the functions interactively in a GUI. The functions are stored in a cell array, caFoo. I use this construct: 

cellfun( @(foo,arg) feval(foo,arg), caFoo, caArg, ... )

The cell array of argument, caArg, need to be of the same length as caFoo and can be created with repmat. However, in this case scalar expansion of caArg would have simplified the code.

/ per</description>
		<content:encoded><![CDATA[<p>I want to excecute many different functions with the same input argument. The user selects the functions interactively in a GUI. The functions are stored in a cell array, caFoo. I use this construct: </p>
<p>cellfun( @(foo,arg) feval(foo,arg), caFoo, caArg, &#8230; )</p>
<p>The cell array of argument, caArg, need to be of the same length as caFoo and can be created with repmat. However, in this case scalar expansion of caArg would have simplified the code.</p>
<p>/ per</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: StephenLL</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-30271</link>
		<dc:creator>StephenLL</dc:creator>
		<pubDate>Tue, 05 May 2009 15:04:55 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-30271</guid>
		<description>You can also check out my _apply_ function at the FEX.

http://www.mathworks.com/matlabcentral/fileexchange/16467

While it doesn&#039;t speed anything up, it makes the code somewhat cleaner.  I wish the mathworks would add something like this to base MATLAB.

Stephen</description>
		<content:encoded><![CDATA[<p>You can also check out my _apply_ function at the FEX.</p>
<p><a href="http://www.mathworks.com/matlabcentral/fileexchange/16467" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/16467</a></p>
<p>While it doesn&#8217;t speed anything up, it makes the code somewhat cleaner.  I wish the mathworks would add something like this to base MATLAB.</p>
<p>Stephen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-30269</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 04 May 2009 11:23:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-30269</guid>
		<description>Everett-

Many MATLAB functions already work on columns of an array or can work on a selected dimension (see help for max, for example).  

--Loren</description>
		<content:encoded><![CDATA[<p>Everett-</p>
<p>Many MATLAB functions already work on columns of an array or can work on a selected dimension (see help for max, for example).  </p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Everett</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-30267</link>
		<dc:creator>Everett</dc:creator>
		<pubDate>Sun, 03 May 2009 15:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-30267</guid>
		<description>Hi, Loren,

How to apply a function to each row of a matrix with out using the for loop?

Thanks,
Everett</description>
		<content:encoded><![CDATA[<p>Hi, Loren,</p>
<p>How to apply a function to each row of a matrix with out using the for loop?</p>
<p>Thanks,<br />
Everett</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-29873</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 18 Nov 2008 18:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-29873</guid>
		<description>Tom-

See the function &lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/ref/bsxfun.html&quot; rel=&quot;nofollow&quot;&gt;bsxfun&lt;/a&gt; for other scalar expansion functionality.

--Loren</description>
		<content:encoded><![CDATA[<p>Tom-</p>
<p>See the function <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/bsxfun.html" rel="nofollow">bsxfun</a> for other scalar expansion functionality.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Clark</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-29872</link>
		<dc:creator>Tom Clark</dc:creator>
		<pubDate>Tue, 18 Nov 2008 18:04:59 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-29872</guid>
		<description>Loren,

Ah ha! I can&#039;t believe I&#039;ve been using MATLAB in anger, daily, for years now - and hadn&#039;t figured out the outer product.

God bless you, this just saved me 586,000 seconds... And then the rest!

Tom</description>
		<content:encoded><![CDATA[<p>Loren,</p>
<p>Ah ha! I can&#8217;t believe I&#8217;ve been using MATLAB in anger, daily, for years now &#8211; and hadn&#8217;t figured out the outer product.</p>
<p>God bless you, this just saved me 586,000 seconds&#8230; And then the rest!</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Melchi</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-28225</link>
		<dc:creator>Melchi</dc:creator>
		<pubDate>Wed, 09 Apr 2008 23:36:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-28225</guid>
		<description>Regarding &quot;How to Add [or multiply] Constant Values to Each Column of a Matrix.&quot; This bothered me for a long time. I used to use what Loren calls &quot;Tony&#039;s Method&quot; (both versions) for a while but got frustrated with it because of the performance hit for large matrices. Though I found the repmat method to be faster than looping, I couldn&#039;t get over the fact that I was doing so many extra additions (or multiplications). Finally, I  wrote a few mex functions (e.g., rowmult(cVec,Matrix), colmult(rVec,Matrix), etc.) that calculate these directly. These are really basic operations that I use so often that I&#039;m really shocked that they aren&#039;t built in to Matlab. While it might be nice to eventually come up with some operators to represent these functions, I think it&#039;s more important that efficient functions implementing these operations be included even if only in functional form.</description>
		<content:encoded><![CDATA[<p>Regarding &#8220;How to Add [or multiply] Constant Values to Each Column of a Matrix.&#8221; This bothered me for a long time. I used to use what Loren calls &#8220;Tony&#8217;s Method&#8221; (both versions) for a while but got frustrated with it because of the performance hit for large matrices. Though I found the repmat method to be faster than looping, I couldn&#8217;t get over the fact that I was doing so many extra additions (or multiplications). Finally, I  wrote a few mex functions (e.g., rowmult(cVec,Matrix), colmult(rVec,Matrix), etc.) that calculate these directly. These are really basic operations that I use so often that I&#8217;m really shocked that they aren&#8217;t built in to Matlab. While it might be nice to eventually come up with some operators to represent these functions, I think it&#8217;s more important that efficient functions implementing these operations be included even if only in functional form.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-25295</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Thu, 24 Jan 2008 12:22:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-25295</guid>
		<description>Peter-

I don&#039;t know what you are trying to calculate. Are the columns year, month, and number.  You&#039;d probably be best off reshaping your array into a 3-dimensional array and summing along the correct dimension(s) then.

--Loren</description>
		<content:encoded><![CDATA[<p>Peter-</p>
<p>I don&#8217;t know what you are trying to calculate. Are the columns year, month, and number.  You&#8217;d probably be best off reshaping your array into a 3-dimensional array and summing along the correct dimension(s) then.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Maclean</title>
		<link>http://blogs.mathworks.com/loren/2006/02/22/scalar-expansion-and-more-take-2/#comment-25271</link>
		<dc:creator>Peter Maclean</dc:creator>
		<pubDate>Wed, 23 Jan 2008 22:10:16 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=23#comment-25271</guid>
		<description>How to calculate a cummulative sum of a matrix over over a given varible. Example, how I calculate year totals from monthly total. The data set look like

Country month Temp
1        1     10
.        .      .
1        12     12
2        1     60
.        .      . 
2        12     72</description>
		<content:encoded><![CDATA[<p>How to calculate a cummulative sum of a matrix over over a given varible. Example, how I calculate year totals from monthly total. The data set look like</p>
<p>Country month Temp<br />
1        1     10<br />
.        .      .<br />
1        12     12<br />
2        1     60<br />
.        .      .<br />
2        12     72</p>
]]></content:encoded>
	</item>
</channel>
</rss>

