function [vvar]=nc_varget(ncfile,ncvar)

%fprintf('inside nc_varget\n');
%keyboard
ncid=netcdf.open(ncfile,'NOWRITE');
vv=netcdf.inqVarID(ncid,ncvar);
vvar=netcdf.getVar(ncid,vv,'double');

ss=size(vvar);
if(length(ss)==2);
  vvar=permute(vvar,[2 1]);
end;

if(length(ss)==3);
  vvar=permute(vvar,[3 2 1]);
end;

netcdf.close(ncid);
