Main Content

saveAttachment

(Not recommended) Save attachment from MDF file

The saveAttachment function is not recommended and might be removed in a future release. Use mdfSaveAttachment instead. See Compatibility Considerations.

Description

example

saveAttachment(mdfObj,AttachmentName) saves the specified attachment from the MDF file to the current MATLAB® working folder. The attachment is saved with its existing name.

example

saveAttachment(mdfObj,AttachmentName,DestFile) saves the specified attachment from the MDF file to the given destination. You can specify relative or absolute paths to place the attachment in a specific folder.

Examples

collapse all

Save an MDF file attachment with its original name in the current folder.

mdfObj = mdf('MDFFile.mf4');
saveAttachment(mdfObj,'AttachmentName.ext')        

Save an MDF file attachment with a new name in the current folder.

mdfObj = mdf('MDFFile.mf4');
saveAttachment(mdfObj,'AttachmentName.ext','MyFile.ext')      

Save an MDF file attachment in a folder specified with a relative path name, in this case in the parent of the current folder.

mdfObj = mdf('MDFFile.mf4');
saveAttachment(mdfObj,'AttachmentName.ext','..\MyFile.ext')      

This example saves an MDF file attachment using an absolute path name.

mdfObj = mdf('MDFFile.mf4');
saveAttachment(mdfObj,'AttachmentName.ext','C:\MyDir\MyFile.ext')

Input Arguments

collapse all

MDF file, specified as an MDF file object.

Example: mdf('MDFFile.mf4')

MDF file attachment name, specified as a character vector or string. The name of the attachment is available in the Name field of the MDF file object Attachment property.

Example: 'file1.dbc'

Data Types: char | string

Destination file name for the saved attachment, specified as a character vector or string. The specified destination can include an absolute or relative path, otherwise the attachment is saved in the current folder.

Example: 'MyFile.ext'

Data Types: char | string

Version History

Introduced in R2016b

expand all

See Also

Functions