how to get the values from netcdf to ascii format through matlab?

4 views (last 30 days)
Girija on 13 Aug 2014
Commented: Girija on 15 Aug 2014
The data is in .nc form (e.g 1) How to extract a grid from this file format? 2) How to find the values of the extracted grid in ascii form?
Girija on 14 Aug 2014
Sir, data is in .nc format ( (temperature data of two years 1948-1949). Its a global data, ve to extract a grid from that data, and the value should be in ascii (csv ) form. I have to read this data and make a average of January month, February month and so on...of two years.
Sir, this data have longitude, latitude, time, and temperature of one pressure level i.e 1000.

Sign in to comment.

Accepted Answer

Chad Greene
Chad Greene on 13 Aug 2014
Check out the names of the variables with ncdisp('') and if one of the variables is lat, you can load it with
lat = ncread('','lat');
Then you can write variables to ascii with dlmwrite.
  1 Comment
Chad Greene
Chad Greene on 13 Aug 2014
It is difficult to understand your question. Try to ask a specific question about a specific step that you're having trouble with.

Sign in to comment.

More Answers (1)

Supreeth Subbaraya
Supreeth Subbaraya on 14 Aug 2014
Take a look at the function ncread. Here you can specify the indices of the starting location of a variable and the number of elements to be read. If a variavle "var" is a two dimensional variable, then you can use the following line of code:
ncread('','var',[1, 1], [1,1])

Community Treasure Hunt

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

Start Hunting!