mlreportgen.utils.findFile

Package: mlreportgen.utils

Find file path

Description

example

filepath = mlreportgen.utils.findFile(filename) returns the full file path from the specified file name. The file name a file name with an extension or a partial file name, which is a file name without an extension.

example

filepath = mlreportgen.utils.findFile(filename,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

filepath = mlreportgen.utils.findFile('MyFile')
filepath = 
  "C:\Users\username\Documents\MyFile"
filepath = mlreportgen.utils.findFile('HTMLFile',["docx" "rtf" "html"])
filepath = 
  "C:\Users\username\Documents\HTMLFile.html"

Input Arguments

collapse all

File name with or without a file extension, specified as a character vector or string scalar.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: mlreportgen.utils.findFile('myFile','FileExtensions',["htm" "html"])

List of file extensions, specified as the comma-separated pair consisting of 'FileExtensions' and a character vector, string array, or cell array of character vectors. mlreportgen.utils.findFile searches for a file name with one of the specified extensions or no extension.

Example: mlreportgen.utils.findFile('myFile','FileExtensions',["docx" "rtf"])

Specify whether the file to find must exist, specified as true or false. If true, the file must exist. If false, the file does not exist. In this case, only the full path of the file with the specified partial file name is created. No file with that path is created.

Output Arguments

collapse all

Path to file, returned as a string scalar.

Introduced in R2018b