Skip to content

Commit a9a0453

Browse files
committed
ncexists() streamline try
1 parent 3309f17 commit a9a0453

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

+stdlib/ncexists.m

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,10 @@
1818
ncinfo(file, variable);
1919
exists = true;
2020
catch e
21-
if stdlib.isoctave()
22-
disp(e)
23-
if strcmp(e.identifier, "Octave:undefined-function") || isempty(strfind(e.message, 'No such file or directory'))
24-
rethrow(e)
25-
end
26-
else
27-
if ~any(contains(e.identifier, ["MATLAB:imagesci:netcdf:badLocationString", "MATLAB:imagesci:netcdf:unknownLocation"]))
28-
rethrow(e)
29-
end
21+
if ~strcmp(e.identifier, "MATLAB:imagesci:netcdf:badLocationString") && ...
22+
~strcmp(e.identifier, "MATLAB:imagesci:netcdf:unknownLocation")
23+
24+
rethrow(e)
3025
end
3126
end
3227

0 commit comments

Comments
 (0)