Skip to content

Commit 18ed724

Browse files
committed
add auto-generated docs
1 parent a764c81 commit 18ed724

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+233
-222
lines changed

+stdlib/+fileio/absolute_path.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
function abspath = absolute_path(p)
2+
%% absolute_path(p)
23
% path need not exist, but absolute path is returned
34
%
45
% NOTE: some network file systems are not resolvable by Matlab Java
56
% subsystem, but are sometimes still valid--so return
67
% unmodified path if this occurs.
78
%
8-
% Copyright (c) 2020 Michael Hirsch (MIT License)
9+
%% Inputs
10+
% * p: path to make absolute
11+
%% Outputs
12+
% * abspath: absolute path, if determined
13+
914
arguments
1015
p (1,:) string
1116
end

+stdlib/+fileio/expanduser.m

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
function expanded = expanduser(p)
2-
% expanded = expanduser(path)
2+
%% expanduser(path)
3+
% expands tilde ~ into user home directory
34
%
4-
% expands tilde ~ into user home directory
5+
% Useful for Matlab functions like h5read() and some Computer Vision toolbox functions
6+
% that can't handle ~
7+
%% Inputs
8+
% * p: path to expand, if tilde present
9+
%% Outputs
10+
% * expanded: expanded path
511
%
6-
% Useful for Matlab functions like h5read() and some Computer Vision toolbox functions
7-
% that can't handle ~ and Matlab does not consider it a bug per conversations with
8-
% Mathworks staff
9-
%
10-
% Benchmark: on laptop and Matlab R2020a
11-
%
12-
% about 200 microseconds
13-
% f = @() expanduser('~/foo');
14-
% timeit(f)
15-
%
16-
% about 2 microseconds:
17-
% f = @() expanduser('foo');
18-
% timeit(f)
19-
%
20-
% See also absolute_path
12+
% See also ABSOLUTE_PATH
13+
2114
arguments
2215
p string
2316
end

+stdlib/+fileio/extract_zstd.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function extract_zstd(archive, out_dir)
2+
%% extract_zstd(archive, out_dir)
23
% extract a zstd file "archive" to "out_dir"
34
% out_dir need not exist yet, but its parent must
45
% We do this with CMake to avoid problems with old system tar.

+stdlib/+fileio/ini2struct.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
function Struct = ini2struct(filename)
2+
%% ini2struct(filename)
23
% Parses .ini file
34
% Returns a structure with section names and keys as fields.
45
%
56
% Based on init2struct.m by Andriy Nych
6-
% 2014/02/01
7-
%
8-
% robustified by Michael Hirsch 2020
7+
98
arguments
109
filename (1,1) string {mustBeFile}
1110
end

+stdlib/+fileio/is_absolute_path.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function isabs = is_absolute_path(apath)
2-
%% true if path is absolute. Path need not yet exist.
2+
%% is_absolute_path(apath)
3+
% true if path is absolute. Path need not yet exist.
34
% even if path has inside ".." it's still considered absolute
45
% e.g. Python
56
% os.path.isabs("/foo/../bar") == True

+stdlib/+fileio/is_exe.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
function ok = is_exe(file)
2-
%% ok = is_exe(file)
3-
% is a file executable?
2+
%% is_exe(file)
3+
% is a file executable, as per its filesystem attributes
4+
% does not actually try to run the file.
5+
%% Inputs
6+
% * file: filename
7+
%% Outputs
8+
% * ok: boolean logical
49

510
arguments
611
file (1,1) string {mustBeNonzeroLengthText}

+stdlib/+fileio/makedir.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function makedir(direc)
2-
%% malformed paths can be "created" but are not accessible.
2+
%% makedir(direc)
3+
% malformed paths can be "created" but are not accessible.
34
% This function works around that bug in Matlab mkdir().
45
arguments
56
direc (1,1) string {mustBeNonzeroLengthText}
@@ -13,6 +14,6 @@ function makedir(direc)
1314

1415
mkdir(direc);
1516

16-
assert(isfolder(direc), 'not a directory %s', direc)
17+
assert(isfolder(direc), "stdlib:fileio:makedir:IOError", 'not a directory %s', direc)
1718

1819
end

+stdlib/+fileio/md5sum.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function hash = md5sum(file)
2+
%% md5sum(file)
23
% compute MD5 hash of file
34
arguments
45
file (1,1) string {mustBeFile}

+stdlib/+fileio/path_tail.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function last = path_tail(apath)
2+
%% path_tail(apath)
23
% get last part of directory path
34
% if filename, return filename with suffix
45
arguments

+stdlib/+fileio/posix.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
function ppath = posix(varargin)
1+
function ppath = posix(file)
2+
%% posix(file)
23
% convert a path or sequence of path components to a Posix path separated
34
% with "/" even on Windows.
45
% If Windows path also have escaping "\" this breaks
6+
arguments
7+
file (1,:) string
8+
end
9+
510

6-
ppath = fullfile(varargin{:});
11+
ppath = fullfile(file);
712

813
if ispc
914
ppath = strrep(ppath, "\", "/");

0 commit comments

Comments
 (0)