Main Content

slreportgen.utils.isMATLABFunction

Check if MATLAB function block or object

Description

example

tf = slreportgen.utils.isMATLABFunction(obj) tests whether the input obj is a Simulink® MATLAB Function block or a Stateflow® MATLAB® function object.

Examples

collapse all

Use isMATLABFunction to test whether a block is a MATLAB Function block.

Find blocks in a container, such as a model, and obtain its results.

blkfinder = slreportgen.finder.BlockFinder(model_name);
results = find(blkfinder);

Then, loop through the results and test whether each block is a MATLAB Function block. For each result that is a MATLAB Function block, create a MATLABFunction reporter, and add the reporter to the report.

for i=1:length(results)
   block = results(i).Object;
   if slreportgen.utils.isMATLABFunction(block)
      rptr = MATLABFunction(block);
      add(myReport,rptr);
   end
end

Input Arguments

collapse all

Simulink element or Stateflow object to check for being a MATLAB Function block, specified as a string or character array of the path or handle.

Output Arguments

collapse all

Whether input is a MATLAB Function block or object, returned as 1 (true) if the input is a MATLAB Function or object. Otherwise, it returns 0 (false).

Introduced in R2018a