Clear Filters
Clear Filters

ncdataset error: Warning: Escaped character '\U' is not valid. See 'doc sprintf' for supported special characters. > In ncdataset (line 89)

8 views (last 30 days)
Hi All,
Trying to use NCTOOLBOX and after downloading a file I try to open it with ncdataset in the following code:
tmpdata = ncdataset('C:\User\MATLAB\Temporary\tmpfile');
The error I get seems to to be related to sprintf that shows up (below). I am using Windows 10 and Java 1.8. I've seen other people have sprintf issues in Windows 10 as well but not the errors like this within ncdataset. Any ideas??
Any thoughts on how to resolve would be greatly appreciated.
Warning: Escaped character '\U' is not valid. See 'doc sprintf' for supported special
characters.
> In ncdataset (line 89)
In GDAS_grab (line 117)
Error using ncdataset (line 91)
Failed to open C:
Error in GDAS_grab (line 117)
tmpdata = ncdataset(outfilename);
Caused by:
Error using ncdataset (line 75)
Java exception occurred:
java.io.IOException: java.lang.RuntimeException: java.lang.NoClassDefFoundError:
ucar/nc2/util/CloseableIterator
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:425)
at ucar.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:699)
at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:421)

Answers (1)

Walter Roberson
Walter Roberson on 25 May 2018
You need to pass a URL to ncdataset(). That includes <file://> prefix for local files, and requires that you use / as the directory separator.
The code probably has a small error in how it uses what is passed to it, but you are passing the wrong thing to it.
  1 Comment
Ryan Oates
Ryan Oates on 27 May 2018
Thanks Walter. I guess what is confusing is this exact code on an older machine and MATLAB license (2014) works perfectly well. Hmmm..

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!