% Read any netcdf file

function [out] = read_netcdfFile(fname)

if ~exist(fname,'file')
    out = [];
    return
end

finfo = ncinfo(fname);
length(finfo.Variables);

for i = 1:length(finfo.Variables)
    nv=finfo.Variables(i).Name;
    nv=strrep(nv,'.','');nv=strrep(nv,'-','');
    try;
        out.(nv) = ncread(fname,finfo.Variables(i).Name);  
        out.Att(i).att = finfo.Variables(i).Attributes;
    catch
        continue
    end;
    
%     out.DataType(i).type = finfo.Variables(i).Datatype;
end
