<div dir="ltr"><div><div>Because you can combine string operands, You can combine the four variables that were in different operands into one operands, and print that whole string instead. Something like:<br><br></div>line.1=xlat.1+' '+x.lon.1+' 'temp.1+' 'ppt.1<br>
<br></div>Be sure to leave appropriate separator like spaces, or commas, depending whether you want to save in binary, text or csv.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 6:56 AM, Andrew Friedman <span dir="ltr"><<a href="mailto:andfried@berkeley.edu" target="_blank">andfried@berkeley.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Uzair,<br>
<br>
I don't think that fprintf alone can make what you're looking for.<br>
<br>
I haven't done this, but two possible approaches come to mind:<br>
1. You can combine the output of different variables from fprintf using an external text processing utility such as awk.<br>
2. You can create a table from netcdf data directly using the NCO (netcdf operator) ncks:<br>
<a href="http://nco.sourceforge.net/nco.html#ncks-netCDF-Kitchen-Sink" target="_blank">http://nco.sourceforge.net/nco.html#ncks-netCDF-Kitchen-Sink</a> (see section 4.7.1: Filters for ncks)<br>
<br>
Can you describe more what you're using the table for? Others may be able to help with a better understanding of the specifics.<br>
<br>
Andrew<br>
<div><div class="h5"><br>
<br>
On Oct 6, 2013, at 10:18 AM, uzair manan <<a href="mailto:uzair_july@hotmail.com">uzair_july@hotmail.com</a>> wrote:<br>
<br>
> GOOD MORNING EVERYONE:<br>
><br>
> I've simulated global data using a regional climate model.. The output it generates is in netcdf format. The output file contains four variables which are :-<br>
> 1. Latitude (xlat)<br>
> 2. Longitude (xlon)<br>
> 3. Temperature (temp)<br>
> 4. Precipitation (ppt)<br>
><br>
> Now how can I generate, using fprintf or any other way, a single file that contains a template as shown below:- (FOR EXAMPLE)<br>
><br>
> LATITUDE LONGITUDE TEMPERATURE PRECIPITATION<br>
><br>
> 23 60 23 10mm<br>
> 23.5 60.5 26 26mm<br>
> . . . .<br>
> . . . .<br>
> . . . .<br>
><br>
> A format like above or anything similar to it will work. Please give an example<br>
><br>
> Any help will be appreciated...<br>
><br>
><br>
><br>
><br>
><br>
> Best regards<br>
><br>
> Uzair Mannan<br>
> Cell: +923323489950<br>
> NED University of Engineering & Technology<br>
> Karachi, Pakistan<br>
><br>
</div></div>> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br></div>