From: Seoeun on
I'm using R2009b version and I installed mexcdf.r3170.zip from http://mexcdf.sourceforge.net today. Even after using addpath for this mexcdf subfolder, netcdf.open is not working. I even tried to use MATLAB functions (netcdf or netcdf.open) without using additional mexcdf or ncx files.
However all I got is just a number, even though my nc file contains three dimensional matrix. Here is what I see from MATLAB.
--------------------------
>> ncid = netcdf.open('v2009.nc','nc_nowrite')

ncid =

4
---------------------------------
or,
---------------------------------------------------------------------
>> ncid = netcdf.open('v2009.nc','nowrite')

ncid =

3
----------------------------------------------------------------------
Please help me. Thank you so much.
From: Kelly Kearney on
"Seoeun " <schoi(a)astate.edu> wrote in message <i0atur$hdn$1(a)fred.mathworks.com>...
> I'm using R2009b version and I installed mexcdf.r3170.zip from http://mexcdf.sourceforge.net today. Even after using addpath for this mexcdf subfolder, netcdf.open is not working. I even tried to use MATLAB functions (netcdf or netcdf.open) without using additional mexcdf or ncx files.
> However all I got is just a number, even though my nc file contains three dimensional matrix. Here is what I see from MATLAB.
> --------------------------
> >> ncid = netcdf.open('v2009.nc','nc_nowrite')
>
> ncid =
>
> 4
> ---------------------------------
> or,
> ---------------------------------------------------------------------
> >> ncid = netcdf.open('v2009.nc','nowrite')
>
> ncid =
>
> 3
> ----------------------------------------------------------------------
> Please help me. Thank you so much.

Looks like everything is working fine. Did you read the documentation? netcdf.open opens a file and returns the file ID. Take a look at the rest of the Matlab netcdf functions (for example, netcdf.getVar) to see how to read in various parts of the file.

I don't think Matlab's interface offers a function that will slurp in the entire file (data, attributes, history, etc.). The snctools toolbox does: nc_getall.m (available from the same mexcdf site above).

-Kelly
From: TideMan on
On Jun 29, 7:42 am, "Seoeun " <sc...(a)astate.edu> wrote:
> I'm using R2009b version and I installed mexcdf.r3170.zip fromhttp://mexcdf.sourceforge.net today. Even after using addpath for this mexcdf subfolder, netcdf.open is not working. I even tried to use MATLAB functions (netcdf or netcdf.open) without using additional mexcdf or ncx files.
> However all I got is just a number, even though my nc file contains three dimensional matrix. Here is what I see from MATLAB.
> --------------------------
>
> >> ncid = netcdf.open('v2009.nc','nc_nowrite')
>
> ncid =
>
>      4
> ---------------------------------
> or,
> ---------------------------------------------------------------------
>
> >> ncid = netcdf.open('v2009.nc','nowrite')
>
> ncid =
>
>      3
> ----------------------------------------------------------------------
> Please help me. Thank you so much.

Well, ncid is just the identification number and all you've done is
open the file.
You now need to read data from the file.

For mexcdf it is:
nc=netcdf('v2009.nc','nowrite');
y=nc{'VariableName'}(:,:,:);

Just to make sure you are pointing to the file correctly and to see
what variables are available do this:
ncdump('v2009.nc')
If this fails, look at the address of the file. Should it have a
path?
From: Seoeun on
Thank you so much!!!! It is working. Again, very many thanks!!