Hauptinhalt

saveTemplate

R2026b

Save Safety Analysis Manager document as a template

Since R2023b

Description

saveTemplate(spreadsheet,fileName) saves the Safety Analysis Manager spreadsheet, spreadsheet, as a template file with the name fileName.

example

saveTemplate(faultTreeDocument,fileName) saves the Safety Analysis Manager fault tree document, faultTreeDocument, as a template file. (since R2026b)

Examples

collapse all

Create a new spreadsheet in the Safety Analysis Manager.

mySpreadsheet = safetyAnalysisMgr.newSpreadsheet;

Add a text and check box column to the spreadsheet.

addColumn(mySpreadsheet,Count=2,Type=["text","checkbox"])

Update the labels of the new columns.

setColumnLabel(mySpreadsheet,2,"text column");
setColumnLabel(mySpreadsheet,3,"checkbox column");

Save the spreadsheet as a template with the name myNewTemplate in the current folder.

saveTemplate(mySpreadsheet,"myNewTemplate.mldatx")

Create a new fault tree document in the Safety Analysis Manager.

myFaultTreeDoc = safetyAnalysisMgr.newDocument("fault-tree");

New fault tree documents contain one fault tree that has one top-level gate. Get the top-level gate and add a basic event to it.

myTopGate = myTreeDoc.Gates(1);
myEvent = createEvent(myTopGate);

Save the fault tree document as a template with the name myNewTemplate in the current folder.

saveTemplate(myFaultTreeDoc,"myNewTemplate.mldatx")

Input Arguments

collapse all

Spreadsheet in the Safety Analysis Manager, specified as a Spreadsheet object.

Fault tree document in the Safety Analysis Manager, specified as a FaultTreeDocument object.

File name of the template, specified as a string scalar or character vector. When specifying the template file name, the .mldatx extension is optional (since R2026a). If you do not want to save the file in the current folder, specify the path and the file name.

Data Types: char | string

Version History

Introduced in R2023b

expand all