Skip to content

Commit 6f9cf36

Browse files
committed
exists: faster and arrays allowed
1 parent 6094406 commit 6f9cf36

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

+stdlib/exists.m

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,8 @@
1010
% * ok: true if exists
1111

1212
function y = exists(p)
13-
arguments
14-
p {mustBeTextScalar}
15-
end
16-
17-
% Matlab >= R2024b allowed URLs to act like files or folders.
18-
% fileattrib() does not consider URLs to be a file or folder
19-
% at least through Matlab R2025a.
2013

21-
y = ~strempty(p) && fileattrib(p) == 1;
14+
y = isfile(p) | isfolder(p);
2215

2316
end
2417

0 commit comments

Comments
 (0)