<?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: Advanced MATLAB: Varargin and Nargin- variable inputs to a function</title>
	<link>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/</link>
	<description>Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.</description>
	<pubDate>Mon, 23 Nov 2009 00:38:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Jiro</title>
		<link>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-766</link>
		<dc:creator>Jiro</dc:creator>
		<pubDate>Sat, 29 Mar 2008 13:39:32 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-766</guid>
		<description>dylan,

Make sure you are using (curly) braces and not parentheses:

&lt;code&gt;alpha = varargin{1}
&lt;/code&gt;

"varargin" is a cell array, so you need to use braces to get the contents of each element. Parentheses will only give you back the element as a cell.</description>
		<content:encoded><![CDATA[<p>dylan,</p>
<p>Make sure you are using (curly) braces and not parentheses:</p>
<p><code>alpha = varargin{1}<br />
</code></p>
<p>&#8220;varargin&#8221; is a cell array, so you need to use braces to get the contents of each element. Parentheses will only give you back the element as a cell.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dylan</title>
		<link>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-767</link>
		<dc:creator>dylan</dc:creator>
		<pubDate>Sat, 29 Mar 2008 03:27:01 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-767</guid>
		<description>i followed your code exactly and i get the following error:
&#62;&#62; main(1)
??? Undefined function or method 'mtimes' for input arguments of type 'cell'.

Error in ==&#62; main at 19
out=alpha * beta;</description>
		<content:encoded><![CDATA[<p>i followed your code exactly and i get the following error:<br />
&gt;&gt; main(1)<br />
??? Undefined function or method &#8216;mtimes&#8217; for input arguments of type &#8216;cell&#8217;.</p>
<p>Error in ==&gt; main at 19<br />
out=alpha * beta;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luca Balbi</title>
		<link>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-765</link>
		<dc:creator>Luca Balbi</dc:creator>
		<pubDate>Fri, 11 Jan 2008 06:59:32 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-765</guid>
		<description>Hello Doug, great work as always!

I think that the recent introduction of the inputParser object has made things evolve a bit with respect to the nargin approach.
Have you ever thought about creating a video with a demo of inputParser?</description>
		<content:encoded><![CDATA[<p>Hello Doug, great work as always!</p>
<p>I think that the recent introduction of the inputParser object has made things evolve a bit with respect to the nargin approach.<br />
Have you ever thought about creating a video with a demo of inputParser?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-764</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Wed, 09 Jan 2008 17:26:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-764</guid>
		<description>Justin,

You can use num2str to make a number into text.  You can have a function output be string if that is what you want.

Doug</description>
		<content:encoded><![CDATA[<p>Justin,</p>
<p>You can use num2str to make a number into text.  You can have a function output be string if that is what you want.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-763</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Wed, 09 Jan 2008 16:59:41 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-763</guid>
		<description>Hi!

I sometimes use "exist" in order to realize variable inputs:

function bla(A,B,D)
if ~exist('D', 'var')
  D = 10; % default value
end
...

Here, I did not hard-code the order and number of input arguments. If I ever want to introduce an additional input C before D, like

function bla(A,B,C,D)

I do not have to change anything (except the function calls of course). I think both alternatives have their pros and cons.

Regards
Markus</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>I sometimes use &#8220;exist&#8221; in order to realize variable inputs:</p>
<p>function bla(A,B,D)<br />
if ~exist(&#8217;D', &#8216;var&#8217;)<br />
  D = 10; % default value<br />
end<br />
&#8230;</p>
<p>Here, I did not hard-code the order and number of input arguments. If I ever want to introduce an additional input C before D, like</p>
<p>function bla(A,B,C,D)</p>
<p>I do not have to change anything (except the function calls of course). I think both alternatives have their pros and cons.</p>
<p>Regards<br />
Markus</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-762</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Tue, 08 Jan 2008 19:32:03 +0000</pubDate>
		<guid>http://blogs.mathworks.com/videos/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-762</guid>
		<description>Can your output ever be a text and not a number?</description>
		<content:encoded><![CDATA[<p>Can your output ever be a text and not a number?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
