Clear Filters
Clear Filters

How to fill and write nc file?

3 views (last 30 days)
JAVAD
JAVAD on 27 Jun 2023
Answered: JAVAD on 27 Jun 2023
Hi all,
I try to extract some variables from my model's data and put in new file.
I can read and extract data from nc file and create new nc file but in filling the variable I have faced problems.
Is it possible to help me?
My code is:
fname = char('output.nc');
............................................
lon = ncread(fname,'lon');
lat = ncread(fname,'lat');
velocity = ncread(fname,'velocity');
...........................................
nccreate("myexample.nc","lat")
>> nccreate("myexample.nc","lon")
>> nccreate("myexample.nc","velocity")
  1 Comment
Mihir
Mihir on 27 Jun 2023
Can you please share the error which you encountered when filling the variable.

Sign in to comment.

Answers (1)

JAVAD
JAVAD on 27 Jun 2023
Error in ncwrite (line 87)
ncObj.write(varName, varData, start, stride);

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!