Readint in multiple .cdf files from a text file

1 visualización (últimos 30 días)
Halley
Halley el 11 de Abr. de 2012
I am needing to open a large number of .cdf files and want to build a loop. Using the ls -1 > file.txt command I created a text file that lists all of the paths of the files I want to open. When I look at it in matlab it looks like this:
micro_use =
'/home/halleykh/test/arps5.2.12/output_test/micro_000600.cdf'
'/home/halleykh/test/arps5.2.12/output_test/micro_001200.cdf'
'/home/halleykh/test/arps5.2.12/output_test/micro_001800.cdf'
'/home/halleykh/test/arps5.2.12/output_test/micro_002400.cdf'
'/home/halleykh/test/arps5.2.12/output_test/micro_003000.cdf'
'/home/halleykh/test/arps5.2.12/output_test/micro_003600.cdf'
When using the netcdf.open command it says that the file name does not exist. I know that it's because of the single quotes. My question is, how do I remove them so that I can open the files in a loop? Thanks.

Respuestas (1)

Ashish Uthama
Ashish Uthama el 12 de Abr. de 2012
  1. You want cdfread not netcdf.open to read CDF files.
  2. It looks like micro_use is a cell array. Use micro_use{index} to access the file name string. Using micro_use[index] gives you a 1x1 cell array which is not what a file reader expects. This blog post ought to make for interesting reading.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by