主要内容

isCallbackEnabled

R2026b

Determine whether custom callbacks are enabled

Since R2024a

Description

status = isCallbackEnabled(spreadsheet,callbacks) returns true for each custom callback in callbacks that is enabled in the spreadsheet, spreadsheet.

example

status = isCallbackEnabled(faultTreeDocument,callbacks) returns true for each enabled custom callback in the fault tree document, faultTreeDocument. (since R2026b)

example

Examples

collapse all

Create a new spreadsheet in the Safety Analysis Manager.

mySpreadsheet = safetyAnalysisMgr.newSpreadsheet;

Add custom callbacks named myCustomCallback1, myCustomCallback2, and myCustomCallback3 to the spreadsheet.

addCallback(mySpreadsheet,"myCallback1")
addCallback(mySpreadsheet,"myCallback2")
addCallback(mySpreadsheet,"myCallback3")

Enable the first two callbacks and disable the third. To retrieve the names of the callbacks, use the getCustomCallbackNames function (since R2026b).

callbackNames = getCustomCallbackNames(mySpreadsheet);
enableCallback(mySpreadsheet,callbackNames,[1,1,0])

Check that the first two callbacks are enabled and the last is disabled.

isCallbackEnabled(mySpreadsheet,sheetNames)
ans =

  1×3 logical array

   1   1   0

Since R2026b

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

myFaultTreeDoc = safetyAnalysisMgr.newSpreadsheet;

Add custom callbacks named myCustomCallback1, myCustomCallback2, and myCustomCallback3 to the fault tree document.

addCallback(myFaultTreeDoc,"myCallback1")
addCallback(myFaultTreeDoc,"myCallback2")
addCallback(myFaultTreeDoc,"myCallback3")

Enable the first two callbacks and disable the third.

callbackNames = getCustomCallbackNames(myFaultTreeDoc);
enableCallback(myFaultTreeDoc,callbackNames,[1,1,0])

Check the status of the three callbacks. The function returns 1 for enabled callbacks and 0 for disabled callbacks.

isCallbackEnabled(myFaultTreeDoc,sheetNames)
ans =

  1×3 logical array

   1   1   0

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.

Custom callback names, specified as a string array or cell array of character vectors.

Data Types: char | string

Output Arguments

collapse all

Whether the callbacks are enabled, returned as a 1 or 0 of data type logical. Each value corresponds to the element with them same index in the callbacks input argument.

Version History

Introduced in R2024a

expand all