netcdf function is not working and the program keep showing this message

netcdf function is not working and the program keep showing this message ??? Undefined function or method 'netcdf' for input arguments of type 'char'.

7 Comments

See documentation on netcdf
and check what
which netcdf -all
returns
Try adding some useful tags to your question if you expect people to provide help.
Hossam - did you follow Per's instructions from the comment above? What was the result of calling which? How are you calling this function? Please copy and paste the commands that you are using that lead to this error message. Also state your version of MATLAB.
My version of Matlab is 7.10.0 (R2010a) when i copy it , this message showed out
M-files in directory C:\Program Files\MATLAB\R2010a\toolbox\matlab\imagesci\+netcdf
Contents getAtt inqDimID renameDim
abort getConstant inqLibVers renameVar
close getConstantNames inqVar setDefaultFormat
copyAtt getVar inqVarID setFill
create inq open sync
defDim inqAtt putAtt
defVar inqAttID putVar
delAtt inqAttName reDef
endDef inqDim renameAtt
-all not found.
the command that i am using is (netcdf(file_name);)
even the command (ncdisp(file_name);) is not working and it is showing this message (??? Undefined function or method 'ncdisp' for input arguments of type 'char'.)

Sign in to comment.

 Accepted Answer

Well, you are using the command wrong.
netcdf(file_name) is not a command.
Note that MATLAB version 2010a was only supporting the kinda one-to-one mapping of (C/FORTRAN) NetCDF api. Recent versions of matlab have other commands that are much easier to read and write a netcdf file. for example ncdisp is not supported in MATLAB 2010a. Neither is ncread.
In that older API you can read a file like this:
% Open the NetCDF file
ncid = netcdf.open('example.nc','NC_NOWRITE');
% returning information from the files:
[ndims,nvars,ngatts,unlimdimid] = netcdf.inq(ncid)
% getting information about a variable
%varid is an integer from 1 to nvars (nvars is the output of previous command.
[varname,xtype,dimids,natts] = netcdf.inqVar(ncid,varid)
% Reading the entire variable
data = netcdf.getVar(ncid,varid)

3 Comments

Thank you, i will try to install the later version
After writing these function, how can i show the real data of the netcdf file in matlab
That's whole another question. The variable data is holding the information. Depending on what type it is, what it is, you can plot it different way.

Sign in to comment.

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!