Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: ncread inside loop
Date: Thu, 06 Jun 2013 11:41:43 -0500
Organization: Aioe.org NNTP Server
Lines: 46
Message-ID: <koqe43$nq7$1@speranza.aioe.org>
References: <kooa9o$3fm$1@newscl01ah.mathworks.com> <koob5t$bo9$1@speranza.aioe.org> <koqcic$a$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: pIxx4zhRD5vG19NNxVs8Ig.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com comp.soft-sys.matlab:796810

On 6/6/2013 11:15 AM, Jonathan W Smith wrote:
> Thanks for the response.
>
> the ncread function for netcdf files needs the
>actual characters of the name. ncread('filename.nc', 'varname')

I do not know anything at all about ncread. But the file name is
there for you to use, it is in the struct returned back by dir().

>
> Once you have used dir to load the multiple files how do you
>load the actual filenames with the single quotes into ncread?
>

The file name is allready a string. Just use it as is. No need
to put '' around it.

---------------------------------
EDU>> A=dir('*.eps');

4x1 struct array with fields:

     name
     date
     bytes
     isdir
     datenum

EDU>> class(A(1).name)

char
--------------------------------

>Is there a netcdf file command that reads in multiple netcdf files?

I do not know.

>
> This command allows you to do this: data_files = {'filename.nc', 'filename2.nc'} but,
>I have 44 files and do not want to write out 44 file names.

Have you thought about using a loop? You have the names in
the data returned by dir(), all what you have to do is make a loop
to read all your netcdf files.

--Nasser