Skip to content

Commit a09f846

Browse files
committed
simplify API
1 parent ba53946 commit a09f846

File tree

14 files changed

+26
-26
lines changed

14 files changed

+26
-26
lines changed

+stdlib/absolute.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
function c = absolute(p, base, expand_tilde, use_java)
2020
arguments
2121
p (1,1) string
22-
base string {mustBeScalarOrEmpty} = string.empty
22+
base (1,1) string = ""
2323
expand_tilde (1,1) logical = true
2424
use_java (1,1) logical = false
2525
end
2626

2727
cwd = stdlib.posix(pwd());
2828

29-
if (isempty(p) || strlength(p) == 0) && (isempty(base) || strlength(base) == 0)
29+
if strlength(p) == 0 && strlength(base) == 0
3030
c = cwd;
3131
return
3232
end
@@ -42,10 +42,10 @@
4242
else
4343
% .getAbsolutePath(), .toAbsolutePath()
4444
% default is Documents/Matlab, which is probably not wanted.
45-
if isempty(base) || strlength(base) == 0
45+
if strlength(base) == 0
4646
c = cwd + "/" + c;
4747
else
48-
d = stdlib.absolute(base, string.empty, expand_tilde, use_java);
48+
d = stdlib.absolute(base, "", expand_tilde, use_java);
4949
if isempty(c) || strlength(c) == 0
5050
c = d;
5151
else

+stdlib/h5save.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function h5save(filename, varname, A, opts)
2424
varname (1,1) string {mustBeNonzeroLengthText}
2525
A {mustBeNonempty}
2626
opts.size (1,:) double {mustBeInteger,mustBeNonnegative} = []
27-
opts.type string {mustBeScalarOrEmpty} = string.empty
27+
opts.type (1,1) string = ""
2828
end
2929

3030
if isnumeric(A)

+stdlib/h5variables.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
function names = h5variables(file, group)
1212
arguments
1313
file (1,1) string {mustBeFile}
14-
group string {mustBeScalarOrEmpty} = string.empty
14+
group (1,1) string = ""
1515
end
1616

17-
if isempty(group) || strlength(group) == 0
17+
if strlength(group) == 0
1818
finf = h5info(file);
1919
else
2020
finf = h5info(file, group);

+stdlib/is_readable.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if use_java
1212
% java is about 10x slower than fileattrib
1313
% needs absolute()
14-
file = stdlib.absolute(file, string.empty, false, use_java);
14+
file = stdlib.absolute(file, "", false, use_java);
1515

1616
ok = java.nio.file.Files.isReadable(java.io.File(file).toPath());
1717
else

+stdlib/is_regular_file.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
opt = java.nio.file.LinkOption.values;
99

1010
% needs absolute()
11-
p = stdlib.absolute(p, string.empty, false, true);
11+
p = stdlib.absolute(p, "", false, true);
1212

1313
isreg = java.nio.file.Files.isRegularFile(java.io.File(p).toPath(), opt);
1414

+stdlib/is_symlink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if isMATLABReleaseOlderThan("R2024b")
1212
% must be absolute path
1313
% NOT .canonical or symlink is gobbled!
14-
p = stdlib.absolute(p, string.empty, false, true);
14+
p = stdlib.absolute(p, "", false, true);
1515
ok = java.nio.file.Files.isSymbolicLink(java.io.File(p).toPath());
1616
else
1717
ok = isSymbolicLink(p);

+stdlib/is_writable.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if use_java
1212
% java is about 10x slower than fileattrib
1313
% needs absolute()
14-
file = stdlib.absolute(file, string.empty, false, use_java);
14+
file = stdlib.absolute(file, "", false, use_java);
1515

1616
ok = java.nio.file.Files.isWritable(java.io.File(file).toPath());
1717
else

+stdlib/ncsave.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function ncsave(filename, varname, A, opts)
1616
varname (1,1) string {mustBeNonzeroLengthText}
1717
A {mustBeNonempty}
1818
opts.dims cell = {}
19-
opts.type string {mustBeScalarOrEmpty} = string.empty
19+
opts.type (1,1) string = ""
2020
end
2121

2222
if isnumeric(A)

+stdlib/ncvariables.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
function names = ncvariables(file, group)
1212
arguments
1313
file (1,1) string {mustBeFile}
14-
group string {mustBeScalarOrEmpty} = string.empty
14+
group (1,1) string = ""
1515
end
1616

17-
if isempty(group) || strlength(group) == 0
17+
if strlength(group) == 0
1818
finf = ncinfo(file);
1919
else
2020
finf = ncinfo(file, group);

+stdlib/private/coerce_ds.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
% used by h5save and ncsave
33
arguments
44
A
5-
dtype string {mustBeScalarOrEmpty}
5+
dtype (1,1) string
66
end
77

88
if ischar(A)
99
A = string(A);
1010
return
1111
end
1212

13-
if isempty(dtype)
13+
if strlength(dtype) == 0
1414
return
1515
end
1616

0 commit comments

Comments
 (0)