netCDF save to variable

7 views (last 30 days)
George
George on 8 Oct 2015
Edited: George on 8 Oct 2015
Hello all
I have a problem saving all the contents of a netCDF file into a structure I keep getting dimension mis-match I would be grateful if you give me any pointers. I know how to open the netCDF and extract point data according to lat, lon, though the process I want to do now is just to save every field (MxN) matrix into a field with increasing numbering (representing 1st measurement, end et.)
this is code thus far
A='file201001';
ncdisp([A'.nc']);
x=ncread([A'.nc'],'hs');
lat=ncread([A'.nc'],'latitude');
lat= rot90(lat, -1);
lat=fliplr(lat);
lon=ncread([A'.nc'],'longitude');
lon= rot90(lon, -1);
lon=fliplr(lon);
[s1,s2,s3]=size(x)
for i=1:s3
B=x(:,:,i);
%B= rot90(B, -1); % These can be omitted since they are just netCDF specific for me to bring the file into a format easier to visualize
%B=fliplr(B);
%contourf(B)
%shading flat
end
Any help is welcome
thanks in advance

Answers (0)

Community Treasure Hunt

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

Start Hunting!