Main Content

validate

Validate block data set

Since R2025a

    Description

    validate(BlockDataSet) validates the partrepo.simscape.BlockDataSet object, BlockDataSet, by attempting to apply the data set to the block and checking for required metadata fields.

    example

    Examples

    collapse all

    This example shows how to create a BlockDataSet object from a Simscape block, update the object, and validate the object.

    Create a model that contains a Simscape block. This example uses a Capacitor block from the Foundation Library.

    modelName = "myModel";
    close_system(modelName,0) 
    libraryBlockName = "fl_lib/Electrical/Electrical Elements/Capacitor";
    open_system(new_system(modelName));
    blockName = add_block(libraryBlockName,modelName + "/" + "Example block");
    

    Create a block data set from the Capacitor block and display the metadata.

    myDataSet = partrepo.simscape.dataSetFromBlock(blockName);
    disp(myDataSet.Metadata)
    Metadata (Incomplete) with properties:
    
                Manufacturer: ""
                  PartNumber: ""
                   BlockType: "SimscapeBlock"
        ParameterizationDate: "19-Nov-2024"
             SimulinkRelease: "25.1"
              ReferenceBlock: "fl_lib/Electrical/Electrical Elements/Capacitor"
              LibraryVersion: "25001000.1"
            ModelingEntityId: "foundation.electrical.elements.capacitor"
          ModelingEntityType: "SimscapeComponent"
            CustomIdentifier: ""
                PartSchemaId: "defaultSimscapeSchema"

    To validate the block data set, the Manufacturer and PartNumber properties must not be empty. Update these properties.

    myDataSet.Metadata.Manufacturer ='My Manufacturer';
    myDataSet.Metadata.PartNumber ='U312_45';
    disp(myDataSet.Metadata)
    Metadata with properties:
    
                Manufacturer: "My Manufacturer"
                  PartNumber: "U312_45"
                   BlockType: "SimscapeBlock"
        ParameterizationDate: "26-Jan-2025"
             SimulinkRelease: "25.1"
              ReferenceBlock: "fl_lib/Electrical/Electrical Elements/Capacitor"
              LibraryVersion: "25001000.1"
            ModelingEntityId: "foundation.electrical.elements.capacitor"
          ModelingEntityType: "SimscapeComponent"
            CustomIdentifier: ""
                PartSchemaId: "defaultSimscapeSchema"

    Validate the block data set.

    validate(myDataSet)

    Input Arguments

    collapse all

    Block data set to validate against a Simscape block, specified as a partrepo.simscape.BlockDataSet object.

    Version History

    Introduced in R2025a