Main Content

mdfRemoveAttachment

Remove attachment from MDF file

Since R2022a

    Description

    mdfRemoveAttachment(mdfFileName, attachmentFile) removes the attachmentFile from the specified mdfFileName.

    To remove multiple files, call this function separately for each file.

    Note

    This function does not support MDF3 files.

    example

    Examples

    collapse all

    Identify the files attached to an MDF file and remove the unwanted one.

    List the attached files from the MDF file information struct.

    info = mdfInfo("MDFFile.mf4");
    info.Attachment.Name
    ans =
    
        'inv_prelim.txt'
    
    
    ans =
    
        'inv_final.txt'
    
    
    ans =
    
        'inv_temp.txt'

    Remove the unwanted attachment.

    mdfRemoveAttachment("MDFFile.mf4","inv_temp.txt")

    Input Arguments

    collapse all

    MDF file name, specified as a string or character vector, to remove the attachment from. The file name can be a relative or absolute path.

    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: "MDF_25Dec.mf4"

    Data Types: char | string

    File to be removed, specified as a string or character vector. To precisely identify the attachment to remove, the specified file name string must exactly match the attachment name as stored in the MDF file, which can be found in the Attachment.Name field of the file information struct returned by mdfInfo.

    Example: "Inv_MDF_25Dec.txt"

    Data Types: char | string

    Version History

    Introduced in R2022a

    expand all

    See Also

    Functions