<?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: Advanced MATLAB: Varargin and Nargin- variable inputs to a function</title>
	<atom:link href="http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/</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: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-14238</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 16 Sep 2011 15:45:42 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-14238</guid>
		<description>@Natasha

Line three is an error command, if it throws an error, it is working as intended.

Doug</description>
		<content:encoded><![CDATA[<p>@Natasha</p>
<p>Line three is an error command, if it throws an error, it is working as intended.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: natasha</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-14237</link>
		<dc:creator>natasha</dc:creator>
		<pubDate>Fri, 16 Sep 2011 09:30:09 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-14237</guid>
		<description>function [Sx, alphao, fo] = autossca(x,fs,df,dalpha)
if nargin ~= 4
  
    error(&#039;Right number of arguments&#039;);
end
Np=pow2(nextpow2(fs/df));
L=Np/4;
P=pow2(nextpow2(fs/dalpha/L));
N=P*L;
if length(x)N
    x=x(1:N);
end
NN=(P-1)*L+Np;
xx=x;
xx(NN)=0;
xx=xx(:);
X=zeros(Np,P);
for k=0:P-1
    X(:,k+1)=xx(k*L+1:k*L+Np);
end
a =hamming(Np);
XW=diag(a)*X;
XF1=fft(XW);
XF1=fftshift(XF1);
XF1=[XF1(:,P/2+1:P) XF1(:,1:P/2)];
E=zeros(Np,P);
for k=-Np/2:Np/2-1
    for m=0:P-1
    E(k+Np/2+1,m+1)=exp(-1i*2*pi*k*m*L/Np);
    end
end
XD=XF1.*E;
XR=zeros(Np,P*L);
for k=1:P
    XR(:,(k-1)*L+1:k*L)= XD(:,k)*ones(1,L);
end
xc=ones(Np,1)*x&#039;;
XM=XR.*xc;
XM=conj(XM&#039;);
XF2=fft(XM);
XF2=fftshift(XF2);
XF2=[XF2(:,Np/2+1:Np) XF2(:,1:Np/2)];
M=abs(XF2);
alphao=(-1:1/N:1)*fs;
fo=(-.5:1/Np:.5)*fs;
Sx=zeros(Np+1,2*N+1);
for k1=1:N
    for k2=1:Np
        alpha=(k1-1)/N+(k2-1)/Np-1;
        f=((k2-1)/Np-(k1-1)/N)/2;
        k=1+Np*(f+.5);
        l=1+N*(alpha+1);
        Sx(k,l)=M(k1,k2);
    end
end
Please help me, im having an error in line 3</description>
		<content:encoded><![CDATA[<p>function [Sx, alphao, fo] = autossca(x,fs,df,dalpha)<br />
if nargin ~= 4</p>
<p>    error(&#8216;Right number of arguments&#8217;);<br />
end<br />
Np=pow2(nextpow2(fs/df));<br />
L=Np/4;<br />
P=pow2(nextpow2(fs/dalpha/L));<br />
N=P*L;<br />
if length(x)N<br />
    x=x(1:N);<br />
end<br />
NN=(P-1)*L+Np;<br />
xx=x;<br />
xx(NN)=0;<br />
xx=xx(:);<br />
X=zeros(Np,P);<br />
for k=0:P-1<br />
    X(:,k+1)=xx(k*L+1:k*L+Np);<br />
end<br />
a =hamming(Np);<br />
XW=diag(a)*X;<br />
XF1=fft(XW);<br />
XF1=fftshift(XF1);<br />
XF1=[XF1(:,P/2+1:P) XF1(:,1:P/2)];<br />
E=zeros(Np,P);<br />
for k=-Np/2:Np/2-1<br />
    for m=0:P-1<br />
    E(k+Np/2+1,m+1)=exp(-1i*2*pi*k*m*L/Np);<br />
    end<br />
end<br />
XD=XF1.*E;<br />
XR=zeros(Np,P*L);<br />
for k=1:P<br />
    XR(:,(k-1)*L+1:k*L)= XD(:,k)*ones(1,L);<br />
end<br />
xc=ones(Np,1)*x&#8217;;<br />
XM=XR.*xc;<br />
XM=conj(XM&#8217;);<br />
XF2=fft(XM);<br />
XF2=fftshift(XF2);<br />
XF2=[XF2(:,Np/2+1:Np) XF2(:,1:Np/2)];<br />
M=abs(XF2);<br />
alphao=(-1:1/N:1)*fs;<br />
fo=(-.5:1/Np:.5)*fs;<br />
Sx=zeros(Np+1,2*N+1);<br />
for k1=1:N<br />
    for k2=1:Np<br />
        alpha=(k1-1)/N+(k2-1)/Np-1;<br />
        f=((k2-1)/Np-(k1-1)/N)/2;<br />
        k=1+Np*(f+.5);<br />
        l=1+N*(alpha+1);<br />
        Sx(k,l)=M(k1,k2);<br />
    end<br />
end<br />
Please help me, im having an error in line 3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13964</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 17 Dec 2010 14:39:37 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13964</guid>
		<description>@yan,

I am not sure, but I think inf might be the problem for the upper limit on the number of arguments.  Can you change it to something like 100 and see if it still fails?

I would put a breakpoint on that line and investigate the values of nargin to make sure it is what you think it is.

Doug</description>
		<content:encoded><![CDATA[<p>@yan,</p>
<p>I am not sure, but I think inf might be the problem for the upper limit on the number of arguments.  Can you change it to something like 100 and see if it still fails?</p>
<p>I would put a breakpoint on that line and investigate the values of nargin to make sure it is what you think it is.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yan yan</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13963</link>
		<dc:creator>yan yan</dc:creator>
		<pubDate>Fri, 17 Dec 2010 06:11:20 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13963</guid>
		<description>Hi,I use a free program to do some tidal analysis.But there are some errors when I run it. Attached is the the beginning of the free program. 
After I test &#039;error(nargchk(2,inf,nargin))&#039;, 
the error informatio shows &#039;??? Error using ==&gt; nargin Not a valid M-file.&#039;

Can you help troubleshoot it? Thank you in advance.


options = struct(&#039;logp&#039;,false); % default options
if ischar(x) &amp;&amp; strcmpi(x,&#039;defaults&#039;)
  f = options;
  return
end

error(nargchk(2,inf,nargin))</description>
		<content:encoded><![CDATA[<p>Hi,I use a free program to do some tidal analysis.But there are some errors when I run it. Attached is the the beginning of the free program.<br />
After I test &#8216;error(nargchk(2,inf,nargin))&#8217;,<br />
the error informatio shows &#8216;??? Error using ==&gt; nargin Not a valid M-file.&#8217;</p>
<p>Can you help troubleshoot it? Thank you in advance.</p>
<p>options = struct(&#8216;logp&#8217;,false); % default options<br />
if ischar(x) &amp;&amp; strcmpi(x,&#8217;defaults&#8217;)<br />
  f = options;<br />
  return<br />
end</p>
<p>error(nargchk(2,inf,nargin))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13338</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Wed, 02 Dec 2009 15:55:08 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13338</guid>
		<description>@Debasish,

Very often people will use structures

a.alpha = 1;
a.beta  = 2;

Cells work too

a{1} = magic(3);
a{2} = &#039;Doug&#039;;

Enjoy,
Doug</description>
		<content:encoded><![CDATA[<p>@Debasish,</p>
<p>Very often people will use structures</p>
<p>a.alpha = 1;<br />
a.beta  = 2;</p>
<p>Cells work too</p>
<p>a{1} = magic(3);<br />
a{2} = &#8216;Doug&#8217;;</p>
<p>Enjoy,<br />
Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Debasish Sarker</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13334</link>
		<dc:creator>Debasish Sarker</dc:creator>
		<pubDate>Wed, 02 Dec 2009 09:56:39 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13334</guid>
		<description>I have a problem.I am making a code using MatLab. This code has some subfunctions.In these subfunctions, sometimes I need to call several numbers of value under one variable name and I want to do this for more than one variable in a subfunction.But I found that one variable can hold only one value. Is there any solution? REply please</description>
		<content:encoded><![CDATA[<p>I have a problem.I am making a code using MatLab. This code has some subfunctions.In these subfunctions, sometimes I need to call several numbers of value under one variable name and I want to do this for more than one variable in a subfunction.But I found that one variable can hold only one value. Is there any solution? REply please</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13121</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 03 Apr 2009 17:39:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13121</guid>
		<description>Seun,

For us to give you some help, you will need to show us what you tried, in code.  There are many things that could have been done incorrectly.  The data you have shown would plot well.  

Doug</description>
		<content:encoded><![CDATA[<p>Seun,</p>
<p>For us to give you some help, you will need to show us what you tried, in code.  There are many things that could have been done incorrectly.  The data you have shown would plot well.  </p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seun</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13120</link>
		<dc:creator>Seun</dc:creator>
		<pubDate>Fri, 03 Apr 2009 17:33:15 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13120</guid>
		<description>Thanks for your reply, I tried the steps you had in your tutorial, I actually don&#039;t know how to use matlab so I am learning on the go. 

I have been able to import the data but when i try to plot the graph i seem to get line graphs which are not correct. 

I have posted sample data below so i can explain better what i am trying to plot

I will go over the links you sent again.

Thanks

x-Height
y-Ergo_Index, Ergo_Index_+Sta. Dev., Ergo_Index_-Sta. Dev.
z-Distance

Height	Distance Ergo_Index Eg_Index_+SDev. Erg_Index_-SDev.
1	1	8.02810	8.48252	7.57368
1	1	7.23410	7.68852	6.77968
1	1	6.77290	7.22732	6.31848
1	1	7.26650	7.72092	6.81208
1	1	7.85150	8.30592	7.39708
1	1	7.44710	7.90152	6.99268
1	2	6.85090	7.92199	5.77981
1	2	7.54950	8.62059	6.47841
1	2	8.84650	9.91759	7.77541
1	2	7.35340	8.42449	6.28231
1	2	9.51260	10.58369	8.44151
1	2	8.99790	10.06899	7.92681
1	3	7.90830	8.11751	7.69909
1	3	7.92300	8.13221	7.71379
1	3	7.99560	8.20481	7.78639
1	3	8.15680	8.36601	7.94759
1	3	7.87130	8.08051	7.66209
1	3	8.08800	8.29721	7.87879
1	3	8.34180	8.55101	8.13259
1	3	7.64370	7.85291	7.43449
2	1	9.67030	10.07334	9.26726
2	1	8.95520	9.35824	8.55216
2	1	8.68640	9.08944	8.28336
2	1	8.75610	9.15914	8.35306
2	1	8.99480	9.39784	8.59176
2	1	9.44720	9.85024	9.04416
2	1	9.73000	10.13304	9.32696
2	1	9.30680	9.70984	8.90376
2	2	7.59970	7.85001	7.34939
2	2	7.38770	7.63801	7.13739
2	2	7.45730	7.70761	7.20699
2	2	7.86410	8.11441	7.61379
2	2	7.61410	7.86441	7.36379
2	2	7.70390	7.95421	7.45359
2	2	8.15410	8.40441	7.90379
2	2	7.87890	8.12921	7.62859
3	3	7.28780	7.86754	6.70806
3	3	7.57240	8.15214	6.99266
3	3	8.52170	9.10144	7.94196
3	3	7.88650	8.46624	7.30676
3	3	7.39120	7.97094	6.81146
3	3	8.50380	9.08354	7.92406
3	3	8.30720	8.88694	7.72746
3	3	8.81800	9.39774	8.23826</description>
		<content:encoded><![CDATA[<p>Thanks for your reply, I tried the steps you had in your tutorial, I actually don&#8217;t know how to use matlab so I am learning on the go. </p>
<p>I have been able to import the data but when i try to plot the graph i seem to get line graphs which are not correct. </p>
<p>I have posted sample data below so i can explain better what i am trying to plot</p>
<p>I will go over the links you sent again.</p>
<p>Thanks</p>
<p>x-Height<br />
y-Ergo_Index, Ergo_Index_+Sta. Dev., Ergo_Index_-Sta. Dev.<br />
z-Distance</p>
<p>Height	Distance Ergo_Index Eg_Index_+SDev. Erg_Index_-SDev.<br />
1	1	8.02810	8.48252	7.57368<br />
1	1	7.23410	7.68852	6.77968<br />
1	1	6.77290	7.22732	6.31848<br />
1	1	7.26650	7.72092	6.81208<br />
1	1	7.85150	8.30592	7.39708<br />
1	1	7.44710	7.90152	6.99268<br />
1	2	6.85090	7.92199	5.77981<br />
1	2	7.54950	8.62059	6.47841<br />
1	2	8.84650	9.91759	7.77541<br />
1	2	7.35340	8.42449	6.28231<br />
1	2	9.51260	10.58369	8.44151<br />
1	2	8.99790	10.06899	7.92681<br />
1	3	7.90830	8.11751	7.69909<br />
1	3	7.92300	8.13221	7.71379<br />
1	3	7.99560	8.20481	7.78639<br />
1	3	8.15680	8.36601	7.94759<br />
1	3	7.87130	8.08051	7.66209<br />
1	3	8.08800	8.29721	7.87879<br />
1	3	8.34180	8.55101	8.13259<br />
1	3	7.64370	7.85291	7.43449<br />
2	1	9.67030	10.07334	9.26726<br />
2	1	8.95520	9.35824	8.55216<br />
2	1	8.68640	9.08944	8.28336<br />
2	1	8.75610	9.15914	8.35306<br />
2	1	8.99480	9.39784	8.59176<br />
2	1	9.44720	9.85024	9.04416<br />
2	1	9.73000	10.13304	9.32696<br />
2	1	9.30680	9.70984	8.90376<br />
2	2	7.59970	7.85001	7.34939<br />
2	2	7.38770	7.63801	7.13739<br />
2	2	7.45730	7.70761	7.20699<br />
2	2	7.86410	8.11441	7.61379<br />
2	2	7.61410	7.86441	7.36379<br />
2	2	7.70390	7.95421	7.45359<br />
2	2	8.15410	8.40441	7.90379<br />
2	2	7.87890	8.12921	7.62859<br />
3	3	7.28780	7.86754	6.70806<br />
3	3	7.57240	8.15214	6.99266<br />
3	3	8.52170	9.10144	7.94196<br />
3	3	7.88650	8.46624	7.30676<br />
3	3	7.39120	7.97094	6.81146<br />
3	3	8.50380	9.08354	7.92406<br />
3	3	8.30720	8.88694	7.72746<br />
3	3	8.81800	9.39774	8.23826</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13119</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 03 Apr 2009 17:12:41 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13119</guid>
		<description>Seun,

There are a few steps to this process, it is not clear to me what you are having problems with.

1.) Import data from Excel. 
http://blogs.mathworks.com/videos/category/excel/

2.) Doing a 3-d bar graph. 
http://www.mathworks.com/matlabcentral/fileexchange/23439

3.) Adding more visualization to a standard plot type.
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f7-20419.html


What have you tried, and specifically where are you stuck?

-Doug</description>
		<content:encoded><![CDATA[<p>Seun,</p>
<p>There are a few steps to this process, it is not clear to me what you are having problems with.</p>
<p>1.) Import data from Excel.<br />
<a href="http://blogs.mathworks.com/videos/category/excel/" rel="nofollow">http://blogs.mathworks.com/videos/category/excel/</a></p>
<p>2.) Doing a 3-d bar graph.<br />
<a href="http://www.mathworks.com/matlabcentral/fileexchange/23439" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/23439</a></p>
<p>3.) Adding more visualization to a standard plot type.<br />
<a href="http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f7-20419.html" rel="nofollow">http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f7-20419.html</a></p>
<p>What have you tried, and specifically where are you stuck?</p>
<p>-Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seun</title>
		<link>http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13118</link>
		<dc:creator>Seun</dc:creator>
		<pubDate>Fri, 03 Apr 2009 17:04:35 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/01/08/advanced-matlab-varargin-and-nargin-variable-inputs-to-a-function/#comment-13118</guid>
		<description>Hi Doug,

Sorry to trouble you, I am trying to plot a 3axis(XYZ) bar graph with some data I have in excel, would attach the data here but it doesn&#039;t seem possible to. 

x-Height
y-Ergo_Index
z-Distance

I also want to plot the mean, standard deviation +/- of the Ergo_Index on the same graph. 

Could you point me in the right direction, I am not too good at matlab, I have tried the gui method to do this but never seem to get a suitable graph or one in 3d either.

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Doug,</p>
<p>Sorry to trouble you, I am trying to plot a 3axis(XYZ) bar graph with some data I have in excel, would attach the data here but it doesn&#8217;t seem possible to. </p>
<p>x-Height<br />
y-Ergo_Index<br />
z-Distance</p>
<p>I also want to plot the mean, standard deviation +/- of the Ergo_Index on the same graph. </p>
<p>Could you point me in the right direction, I am not too good at matlab, I have tried the gui method to do this but never seem to get a suitable graph or one in 3d either.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

