Main Content

mdfSaveAttachment

Save embedded attachment files from MDF file

Since R2023a

    Description

    example

    mdfSaveAttachment(mdfFileName) saves all the embedded attachments from the specified MDF file to the current MATLAB working folder. The attachments are saved with their existing names. mdfFileName specifies an absolute, relative, or URL path to the MDF file. The MDF file itself can be on a remote server, but the attachments saved by mdfSaveAttachment are local files.

    mdfSaveAttachment(___, Attachment=attachmentID) saves only those attachments specified by attachment ID, indicating an attachment numerical index or string name. Specify multiple indices or strings in an array.

    mdfSaveAttachment(___, OutputFolder=outputFolder) specifies the location for the saved files.

    Examples

    collapse all

    Given the MDF file MDFFie.mf4, save its embedded attachments.

    For a local file, save all its embedded attachments to the current working folder.

    mdfSaveAttachment("MDFFile.mf4")

    For a file on a remote server, save all its attachments to the current working folder.

    mdfSaveAttachment("s3://bucketname/MDFFolder/MDFFile.mf4")

    Save specified embedded attachments to the current working folder.

    mdfSaveAttachment("MDFFile.mf4", Attachment=["Attachment1.ext", "Attachment2.ext"])
    mdfSaveAttachment("MDFFile.mf4", Attachment=[1, 3, 4])

    Save all attachments to a specified folder.

    mdfSaveAttachment("MDFFile.mf4", OutputFolder="D:\MyDir")

    Input Arguments

    collapse all

    MDF file name, specified as a string or character vector, including the necessary full or relative path. You can use a URL to specify a file on a remote server.

    Depending on the location you are accessing, mdfFileName can take one of these forms.

    Location

    Form

    Current folder or MATLAB® path

    To access a file in the current folder or MATLAB path, specify the name of the file in filename, including the file extension.

    Example: "myMdfFile.mf4"

    Other folders

    To access a file in a folder other than the current folder, specify the full or relative path name in filename.

    Example: "C:\myFolder\myMdfFile.mf4"

    Example: "\dataDir\myMdfFile.mf4"

    Remote locations

    To access a file in a remote location, filename must contain the full path of the file specified as a uniform resource locator (URL) of the form:

    scheme://path_to_file/myMdfFile.mf4

    Based on the remote location, scheme can be one of the values in this table.

    Remote Locationscheme
    Amazon S3™s3
    Windows Azure® Blob Storagewasb, wasbs
    HDFS™hdfs

    For more information, see Work with Remote Data.

    Example: "s3://bucketname/path_to_file/myMdfFile.mf4"

    Example: "MDFFile.mf4"

    Data Types: string | char

    Names or indices of attached files to save. To save a single attachment, specify attachmentID as a string, character vector, or numerical index value. To save multiple attachments, specify attachmentID as a string vector, cell array of character vectors, or numerical vector.

    Example: Attachment=[1:4]

    Example: Attachment=["Attachment1.ext","Attachment2.ext"]

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | char | string | cell

    Location for saved attachments, specified as a string or character vector identifying a full or relative path.

    Example: outputFolder="D:\myWorkPath"

    Data Types: string | char

    Version History

    Introduced in R2023a

    expand all