ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
webglob.m File Reference

Go to the source code of this file.

Functions

function webglob (in pattern, in anycase)
 Return a scalar MATLAB string or vector of MATLAB strings containing the fully-resolved paths matching the input pattern.
More...
 

Function Documentation

◆ webglob()

function webglob ( in  pattern,
in  anycase 
)

Return a scalar MATLAB string or vector of MATLAB strings containing the fully-resolved paths matching the input pattern.

This function is very similar to pm.sys.path.glob.
However, unlike pm.sys.path.glob, if the input pattern matches a World Wide Web link, it will also download the file to a temporary path on the system and the temporary download path as the output.

Parameters
[in]pattern: The input scalar MATLAB string containing either:
  1. the pattern to search for paths on the current system.
    Wildcards may be used for basenames and for the directory parts.
    If pattern contains directory parts, then these will be included in the output pathList.
    Following wildcards can be used:
    1. * match zero or more characters.
    2. ? match any single character.
    3. [ab12] match one of the specified characters.
    4. [^ab12] match none of the specified characters.
    5. [a-z] match one character in range of characters.
    6. {a,b,c} matches any one of strings a, b, or c.
    7. All above wildcards do not match a file separator.
    8. ** match zero or more characters including file separators.
      This can be used to match zero or more directory parts and will recursively list matching names.
  2. the weblink to download and save locally on the system temporary folder.
[in]anycase: The input scalar MATLAB logical.
If true, the search will be case-sensitive.
If false, the search will be case-insensitive.
On Windows, anycase is always reset to true even if user-specified.
(optional. default = false on Unix and true on Windows.)
Returns
pathList : The output MATLAB cell array of strings containing the files or directories that match the path specified by string pattern.
isdirList : The output MATLAB cell array of the same size as pathList, each element of which is a MATLAB logical value that is true if and only if the corresponding element of pathList is a directory.
Warning
Symbolic linked directories or junctions may cause an infinite loop when using the **.


Possible calling interfaces

[pathList, isdirList] = pm.sys.path.webglob(pattern)
[pathList, isdirList] = pm.sys.path.webglob(pattern, anycase)


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../../'); % Add the ParaMonte library root directory to the search path.
3
4pm.matlab.show()
5pm.matlab.show('pm.sys.path.webglob("https://apod.nasa.gov/apod/astropix.html")')
6pm.matlab.show( pm.sys.path.webglob("https://apod.nasa.gov/apod/astropix.html") )
7
8pm.matlab.show()
9pm.matlab.show('pm.sys.path.webglob("https://github.com/cdslaborg/paramontex/blob/fbeca6745684c798ff28c1bf57cfae0c190db478/MATLAB/mlx/sampling_multivariate_normal_distribution_via_paradram/out/mvn_serial_process_1_report.txt")')
10pm.matlab.show( pm.sys.path.webglob("https://github.com/cdslaborg/paramontex/blob/fbeca6745684c798ff28c1bf57cfae0c190db478/MATLAB/mlx/sampling_multivariate_normal_distribution_via_paradram/out/mvn_serial_process_1_report.txt") )
11
12pm.matlab.show()
13pm.matlab.show('pm.sys.path.webglob("*.m")')
14pm.matlab.show( pm.sys.path.webglob("*.m") )
15
16pm.matlab.show()
17pm.matlab.show('pm.sys.path.webglob("example/array/**")')
18pm.matlab.show( pm.sys.path.webglob("example/array/**") )
19
20pm.matlab.show()
21pm.matlab.show('pm.sys.path.webglob("example/array/**.m")')
22pm.matlab.show( pm.sys.path.webglob("example/array/**.m") )
23
24pm.matlab.show()
25pm.matlab.show('pm.sys.path.webglob("example/array/*.m")')
26pm.matlab.show( pm.sys.path.webglob("example/array/*.m") )
27
28pm.matlab.show()
29pm.matlab.show('pm.sys.path.webglob(".*")')
30pm.matlab.show( pm.sys.path.webglob(".*") )
31
32pm.matlab.show()
33pm.matlab.show('[paths, isdir] = pm.sys.path.webglob("**"); paths(~isdir) % get all files in directory tree.')
34 [paths, isdir] = pm.sys.path.webglob("**"); paths(~isdir) % get all files in directory tree.
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.

Example output
1
2pm.sys.path.webglob("https://apod.nasa.gov/apod/astropix.html")
3/tmp/astropix.html
4
5pm.sys.path.webglob("https://github.com/cdslaborg/paramontex/blob/fbeca6745684c798ff28c1bf57cfae0c190db478/MATLAB/mlx/sampling_multivariate_normal_distribution_via_paradram/out/mvn_serial_process_1_report.txt")
6/tmp/mvn_serial_process_1_report.txt.html
7
8pm.sys.path.webglob("*.m")
9 "main.m"
10 "main.out.m"
11
12pm.sys.path.webglob("example/array/**")
13
14pm.sys.path.webglob("example/array/**.m")
15
16pm.sys.path.webglob("example/array/*.m")
17
18pm.sys.path.webglob(".*")
19
20[paths, isdir] = pm.sys.path.webglob("**"); paths(~isdir) % get all files in directory tree.
21ans =
22 2x1 string array
23 "main.m"
24 "main.out.m"


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Joshua Alexander Osborne, May 21 2024, 5:10 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin