Merging multiple .txt files into one NetCDF file

조회 수: 1 (최근 30일)
Kerstin Bergentz
Kerstin Bergentz 2020년 4월 15일
답변: Jyotsna Talluri 2020년 4월 23일
Hi,
I have climate data from different stations in 37 separate .txt files (one per station). The text files all have 10 columns with different variables (precpitation, lat/lon etc), and one row per day (about 90 days), they all have the same days. I want to merge these .txt files into one .nc file. How would I go about doing that?

채택된 답변

Jyotsna Talluri
Jyotsna Talluri 2020년 4월 23일
First,you can read the text files into tables of data using readtable. Merge the data of the 37 tables to a single table.Convert the table of data to a matrix as table datatype is not supported to write to a NetCDF file. Create a NetCDF file and a variable with 90*37 rows and 10 columns as dimensions using nccreate function.Write the matrix of data to the created variable using ncwrite function.
Refer to the documentation links of the below functions

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by