Skip to content

Commit 63b9a1a

Browse files
committed
don't use keyword as variable
1 parent f1d28b3 commit 63b9a1a

File tree

8 files changed

+47
-25
lines changed

8 files changed

+47
-25
lines changed

+stdlib/is_wsl_path.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
%
33
% Ref: https://learn.microsoft.com/en-us/windows/wsl/filesystems
44

5-
function iswsl = is_wsl_path(path)
5+
function iswsl = is_wsl_path(p)
66
arguments
7-
path (1,1) string {mustBeNonzeroLengthText}
7+
p (1,1) string {mustBeNonzeroLengthText}
88
end
99

1010
if ispc
11-
iswsl = any(startsWith(path, ["\\wsl$", "\\wsl.localhost"]));
11+
iswsl = any(startsWith(p, ["\\wsl$", "\\wsl.localhost"]));
1212
else
1313
iswsl = false;
1414
end

+stdlib/java_api.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
% major version is first number before "."
88

99
a = split(v, ".");
10+
if(isempty(a))
11+
api = 0;
12+
return
13+
end
14+
1015
if a(1) == "1"
1116
api = double(a(2));
1217
else

+stdlib/stem.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
%% STEM filename without directory or suffix
22

3-
function p = stem(path)
3+
function p = stem(p)
44
arguments
5-
path string
5+
p string
66
end
77

8-
[~, p] = fileparts(path);
8+
[~, p] = fileparts(p);
99

1010
end

+stdlib/suffix.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
%% SUFFIX last suffix of filename
22

3-
function s = suffix(path)
3+
function s = suffix(p)
44
arguments
5-
path string
5+
p string
66
end
77

8-
[~, ~, s] = fileparts(path);
8+
[~, ~, s] = fileparts(p);
99

1010
end

+stdlib/with_suffix.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
%% WITH_SUFFIX switch file extension
22
%
33
%%% Inputs
4-
% * filename: original filename
4+
% * p: path to modify
55
% * suffix: file extension with "." e.g. ".dat"
66
%%% Outputs
7-
% * filename: modified filename
7+
% * f: modified filename
88

9-
function f = with_suffix(filename, suffix)
9+
function f = with_suffix(p, suffix)
1010
arguments
11-
filename (1,1) string
11+
p (1,1) string
1212
suffix (1,1) string
1313
end
1414

15-
p = stdlib.parent(filename);
16-
s = stdlib.stem(filename);
15+
r = stdlib.parent(p);
16+
s = stdlib.stem(p);
1717

1818
if strlength(s) == 0
19-
f = stdlib.join(filename, suffix);
19+
f = stdlib.join(p, suffix);
2020
return
2121
end
2222

23-
if p == "."
23+
if r == "."
2424
f = s;
2525
else
26-
f = p + "/" + s;
26+
f = r + "/" + s;
2727
end
2828

2929
f = f + suffix;

+stdlib/wsl_tempfile.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
%% WSL_TEMPFILE get temporary file from WSL
22
% Windows Subsystem for Linux (WSL) temporary file from Windows Matlab
33

4-
function path = wsl_tempfile()
4+
function p = wsl_tempfile()
55
arguments (Output)
6-
path (1,1) string {mustBeNonzeroLengthText}
6+
p (1,1) string {mustBeNonzeroLengthText}
77
end
88

99
assert(stdlib.has_wsl(), "stdlib:sys:wsl_tempfile:EnvironmentError", mfilename() + "only supported on Windows Matlab with WSL")
1010

11-
[stat, path] = system("wsl mktemp -u");
11+
[stat, p] = system("wsl mktemp -u");
1212

13-
assert(stat == 0, "stdlib:sys:wsl_tempfile:IOError", "could not get wsl mktemp " + path)
13+
assert(stat == 0, "stdlib:sys:wsl_tempfile:IOError", "could not get wsl mktemp " + p)
1414

15-
path = strip(path);
15+
p = strip(p);
1616

1717
end

Readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ some Matlab-stdlib functions do not work.
2727
We have a [CI job that tests without Java](https://github.com/geospace-code/matlab-stdlib/actions/workflows/ci-nojvm.yml).
2828

2929

30-
3130
## Acknowledgments
3231

3332
Stdlib for Matlab was partly funded by NASA NNH19ZDA001N-HDEE grant 80NSSC20K0176.

Readme_java.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ Get the JVM version with
2626
version("-java")
2727
```
2828

29+
Get the JVM details with
30+
31+
```matlab
32+
jenv
33+
```.
34+
35+
Get the Java API level:
36+
37+
```matlab
38+
stdlib.java_api
39+
```
40+
41+
Get the Java version:
42+
43+
```matlab
44+
stdlib.java_version
45+
```
46+
2947
The Matlab default
3048
[JVM can be configured](https://www.mathworks.com/help/matlab/matlab_external/configure-your-system-to-use-java.html)
3149
to
@@ -47,7 +65,7 @@ jenv("/path/to/jdk-17/Contents/Home")
4765

4866
To
4967
[revert back to the factory JRE](https://www.mathworks.com/help/matlab/ref/matlab_jenv.html)
50-
if Matlab can't start or has problems, from system Terminal do:
68+
if Matlab can't start or has problems, from system Terminal (not within Matlab):
5169

5270
```sh
5371
matlab_jenv factory

0 commit comments

Comments
 (0)