Main Content

mdfCreate

Create MDF-file with metadata

    Description

    example

    mdfCreate(mdfFile) creates an MDF-file at the location specified by mdfFile, using default file metadata. The file name must include the extension .dat, .mdf, or .mf4.

    example

    mdfCreate(mdfFile,FileInfo=infoStruct) creates an MDF-file using the specified metadata to configure during file creation. The structure infoStruct must be of the form returned by the mdfInfo function, which you can use to create the structure and then modify it as needed. The supported values for the infoStruct.Version field are '3.00', '3.10', '3.20', '3.30', '4.00', '4.10', and '4.20'.

    newMDFFile = mdfCreate(___) creates an MDF-file and returns its full path name as a string to the variable newMDFFile.

    Examples

    collapse all

    Create a new MDF-file, and view its metadata.

    mdfCreate("MDF_25Dec.mf4")
    ans = 
    
        "C:\data\mdf\MDF_25Dec.mf4"
    mdfInfo("MDF_25Dec.mf4")
    ans = 
    
      struct with fields:
    
                     Name: 'MDF_25Dec.mf4'
                     Path: 'C:\data\mdf\MDF_25Dec.mf4'
                   Author: ''
               Department: ''
                  Project: ''
                  Subject: ''
                  Comment: ''
                  Version: '4.20'
        ProgramIdentifier: 'MATLAB'
         InitialTimestamp: 2021-12-01 17:31:29.000000000
                  Creator: [1×1 struct]
               Attachment: [0×1 struct]

    Create a new MDF-file with modified metadata.

    Create a default information structure.

    info = mdfInfo
    info = 
    
      struct with fields:
    
                  Author: ''
              Department: ''
                 Project: ''
                 Subject: ''
                 Comment: ''
                 Version: '4.20'
        InitialTimestamp: NaT
                 Creator: [1×1 struct]

    Modify a field of the information structure, then use it to create an MDF-file.

    info.Version = "4.10";
    mdfCreate("MDF_25Dec.mf4",FileInfo=info);
    mdfInfo("MDF_25Dec.mf4")
    ans = 
    
      struct with fields:
    
                     Name: 'MDF_25Dec.mf4'
                     Path: 'C:\data\mdf\MDF_25Dec.mf4'
                   Author: ''
               Department: ''
                  Project: ''
                  Subject: ''
                  Comment: ''
                  Version: '4.10'
        ProgramIdentifier: 'MATLAB'
         InitialTimestamp: 2021-12-01 18:54:42.000000000
                  Creator: [1×1 struct]
               Attachment: [0×1 struct]

    Input Arguments

    collapse all

    MDF-file name to create, specified as a string or character vector. The file name can be a relative or absolute path. The name must include the extension .dat, .mdf, or .mf4.

    Example: "MDF_25Dec.mf4"

    Data Types: char | string

    Output Arguments

    collapse all

    Full path name of the newly created MDF-file, returned as a string.

    Version History

    Introduced in R2022a