nccreate overwrite existing file

How to use nccreate to create a new file clobbering any previous file with the same name?
Matlab's question-begging documentation doesn't help. Here's matlab's info on nccreate:
"If filename does not exist, then nccreate creates the file using the netcdf4_classic format."
Great, but if the filename does exist?

 採用された回答

Stijn Haenen
Stijn Haenen 2019 年 11 月 26 日

0 投票

Have you tried this:
if exist(filename)
delete filename
end
nccreate.....

その他の回答 (1 件)

oceanmod
oceanmod 2019 年 11 月 26 日

0 投票

Thanks for your response. Low-level netcdf functions like netcdf.create have an explicit clobber option. Am baffled why the corresponding high-level functions (i.e., nccreate) would not have a similar option. It looks like what you suggest might be the only way.

質問済み:

2019 年 11 月 26 日

回答済み:

2019 年 11 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by