help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

isempty not working properly


From: xnand
Subject: isempty not working properly
Date: Thu, 29 Apr 2010 04:23:35 -0700 (PDT)

Hi everyone.

The following code creates a netcdf file and then isempty checks if it is
empty. But though it is not empty, it shows the file as empty.

latitude = -90:1:90;
longitude = -179:1:180;
[y,x] = meshgrid(pi/180 * latitude,pi/180 * longitude);
temp = cos(2*x) .* cos(y);
nc = netcdf('example.nc','c');
nc('longitude') = 360;
nc('latitude') = 181;
nc{'longitude'} = ncdouble('longitude');
nc{'longitude'}(:) = longitude;
nc{'longitude'}.units = 'degree West';
nc{'latitude'} = ncdouble('latitude');
nc{'latitude'}(:) = latitude;
nc{'latitude'}.units = 'degree North';
nc{'temp'} = ncdouble('longitude','latitude');
nc{'temp'}(:) = temp;
nc{'temp'}.units = 'degree Celsius';
nc{'temp'}.valid_range = [-10 40];
ncclose(nc);

if isempty(nc)
    disp(' ## The file is empty.')
end

Please note, netcdf function is from octcdf package.

Thanks,
Nanddeep
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/isempty-not-working-properly-tp2075313p2075313.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]