Main Content


Find blocks from block library

Since R2023b



blockObjects = findBlock(lib,blockNames) finds a block or vector of blocks from the block library lib.


collapse all

Import the pipeline, block, and library objects needed for the example.

import bioinfo.pipeline.library.*
import bioinfo.pipeline.block.*
import bioinfo.pipeline.Pipeline 

Create a library and add it to the list of available libraries.

mylib = Library;
mylib.Name = "customLib";

Create a FeatureCount block and a FileChooser block for a FASTQ file, that is provided with the toolbox and add to the library.

fcBlock = FeatureCount;
fastqfile = FileChooser(which("SRR005164_1_50.fastq"));

Add the blocks to the library. Name the blocks as "featurecount" and "fastqfile", respectively.


Find a block by its name from the library.

b1 = findBlock(mylib,"featurecount")
b1 = 
  FeatureCount with properties:

         Options: [1x1 bioinfo.pipeline.options.FeatureCountOptions]
          Inputs: [1x1 struct]
         Outputs: [1x1 struct]
    ErrorHandler: []

You can also search for multiple blocks.

bArray = findBlock(mylib,["fastqfile","featurecount"]);
ans = 2

Rename the "featurecount" block to "fcBlock".

ans = 2x1 string

Input Arguments

collapse all

Block library, specified as a bioinfo.pipeline.library.Library object.

Names of blocks to find, specified as a character vector, string scalar, string vector, or cell array of character vectors.

Data Types: char | string | cell

Output Arguments

collapse all

Block objects, returned as a bioinfo.pipeline.Block object or a vector of block objects.

Version History

Introduced in R2023b