<div dir="ltr"><div>Thanks it is working.<br><br></div>Ipsita<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 23, 2014 at 10:32 PM, Gustavo Correa <span dir="ltr">&lt;<a href="mailto:gus@ldeo.columbia.edu" target="_blank">gus@ldeo.columbia.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ipsita<br>
<br>
Maybe this?<br>
<br>
path=&quot;/dummy/file.&quot;+sprinti(&quot;%0.2i&quot;,nf)+&quot;.grd&quot;  ;  &lt;= &quot;%0.2i&quot; formats nf w/ 2 digits: 01,02,...,10...<br>
<br>
See:<br>
<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/sprinti.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/sprinti.shtml</a><br>
<br>
I hope this helps,<br>
Gus Correa<br>
<br>
On Nov 23, 2014, at 9:39 AM, Ipsita Putatunda wrote:<br>
<br>
&gt; Potentially dangerous attachments were identified and removed from this<br>
&gt; message.<br>
<span class="">&gt;<br>
&gt; Hi NCL users,<br>
&gt;   I need a help on writing output files inside a loop...That may be easy<br>
&gt; but not working for me, any help will be appreciated.<br>
&gt;<br>
&gt; First am reading the files inside a loop and doing the needed operations. I<br>
&gt; want to write output files according to the each opened file which am<br>
&gt; reading inside loop. I want an incremental loop in the name of the output<br>
&gt; files...like file.21.grd, file.22.grd, file.23.grd...etc upto nfil-1.<br>
&gt;<br>
&gt; ;*****************************************************************<br>
&gt;<br>
&gt; diri = &quot;./&quot;<br>
&gt;<br>
&gt;  fili = systemfunc(&quot;cd &quot;+diri+&quot; ; ls *.nc&quot;)<br>
&gt;  nfil = dimsizes( fili )<br>
&gt;  print(&quot;nfil=&quot;+nfil)<br>
&gt;<br>
&gt; ;*****************************************************************<br>
&gt; ; Loop over the files<br>
&gt; ;*****************************************************************<br>
&gt;  tStrt = systemfunc(&quot;date&quot;)         ; time the loop (wall clock)<br>
&gt;<br>
&gt;  do nf=0,nfil-1<br>
&gt;     print(nf+&quot;   &quot;+fili(nf))<br>
&gt;     f       = addfile(diri+fili(nf), &quot;r&quot;) &lt;===reading data for each file<br>
&gt;<br>
&gt;  ........Doing rest of the operations.....<br>
&gt;<br>
</span>&gt; *path=&quot;/dummy/file.21.grd&quot; &lt;==here I want the file name **increment*<br>
<span class="im HOEnZb">&gt;<br>
&gt; fbindirwrite(path,z) &lt;=======output files<br>
&gt;<br>
&gt; end do<br>
&gt;<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; Ipsita<br>
</span><div class="HOEnZb"><div class="h5">&gt; _______________________________________________<br>
&gt; ncl-talk mailing list<br>
&gt; List instructions, subscriber options, unsubscribe:<br>
&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</div></div></blockquote></div><br></div>