<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236309</link>
    <title>MATLAB Central Newsreader - What's wrong in my tiny little code?</title>
    <description>Feed for thread: What's wrong in my tiny little code?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 21 Sep 2008 12:38:03 -0400</pubDate>
      <title>What's wrong in my tiny little code?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236309#601264</link>
      <author>Kuo-Hsien </author>
      <description>Hi -&lt;br&gt;
&lt;br&gt;
I was wondering anything wrong in this code. It should save many files to another folder, however it just saved them in one file in which the file name is (filename(n).name). Please give me a hand.&lt;br&gt;
&lt;br&gt;
Michael&lt;br&gt;
&lt;br&gt;
function pad_wx_data&lt;br&gt;
filename = dir ('*.txt');&lt;br&gt;
n=1;&lt;br&gt;
[i,j]=size(filename);&lt;br&gt;
while n&amp;lt;i+1&lt;br&gt;
x = load(filename(n).name);&lt;br&gt;
[rr,cc] = size(x);&lt;br&gt;
day_number = datenum(x(:,1:3));&lt;br&gt;
full_day_number = [min(day_number):max(day_number)]';&lt;br&gt;
y = [full_day_number NaN*ones(length(full_day_number),cc-3)];&lt;br&gt;
[jnk,uix,uiy] = intersect(day_number,full_day_number);&lt;br&gt;
y(uiy,2:size(y,2)) = x(uix,4:cc);&lt;br&gt;
save('/Users/cks/Documents/jon/hfdata/us/WI/test/perl/test_4/out/product/(filename(n).name)', 'y')&lt;br&gt;
n=n+1;&lt;br&gt;
end&lt;br&gt;
clear temp n i j</description>
    </item>
    <item>
      <pubDate>Sun, 21 Sep 2008 15:15:04 -0400</pubDate>
      <title>Re: What's wrong in my tiny little code?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236309#601272</link>
      <author>Tom </author>
      <description>&quot;Kuo-Hsien &quot; &amp;lt;mchangks@hotmail.com&amp;gt; wrote in message &amp;lt;gb5f7b$3gg$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I was wondering anything wrong in this code. It should save many files to another folder, however it just saved them in one file in which the file name is (filename(n).name). Please give me a hand.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; save('/Users/cks/Documents/jon/hfdata/us/WI/test/perl/test_4/out/product/(filename(n).name)', 'y')&lt;br&gt;
&lt;br&gt;
The line of code above is the problem.  The save file name is &quot;(filename(n).name)&quot;.  Try the following change:&lt;br&gt;
&lt;br&gt;
save(['/Users/cks/Documents/jon/hfdata/us/WI/test/perl/test_4/out/product/' filename(n).name], 'y')&lt;br&gt;
&lt;br&gt;
This should concatenate filename(n).name onto the end of the path.</description>
    </item>
  </channel>
</rss>

