Contenuto principale

bioinfo.pipeline.block.Concatenate

Concatenate data

Since R2026a

  • concatenate block icon

Description

A Concatenate block enables you to combine multiple inputs into a single output. Use this block when you need to combine multiple input data and pass such combined data to downstream blocks for further analysis. For instance, you can use this block to combine several filenames into a single list of files, or join multiple output tables into one table for further processing.

Creation

Description

b = bioinfo.pipeline.block.Concatenate creates a Concatenate block.

example

b = bioinfo.pipeline.block.Concatenate(Name=Value) sets the block properties using one or more name-value arguments. Name is the property name and Value is the property value.

Properties

expand all

Dimension in which to combine the input data, specified as a positive integer scalar.

By default, the block uses the row dimension (dimension 1), that is, it combines data vertically. For example, if both input data are 2-by-2 matrices, then the block combines them vertically to produce a 4-by-2 matrix. This block works similarly to the cat function. For more information about dimensions, see Multidimensional Arrays.

Data Types: double

Input port names, specified as a character vector, string scalar, string vector, or cell array of character vectors.

Data Types: char | string | cell

Output port name, specified as a string scalar or character vector.

Data Types: char | string

This property is read-only.

Input ports of the block, specified as a structure. The field names of the structure are the names of the block input ports, and the field values are bioinfo.pipeline.Input objects. These objects describe the input port behaviors. The input port names are the expected field names of the input structure that you pass to the block run method.

The Concatenate block Inputs structure has the following fields:

  • Input1 — First input. This input is required and must be satisfied.

  • Input2 — Second input. This input is required and must be satisfied.

Data Types: struct

This property is read-only.

Output ports of the block, specified as a structure. The field names of the structure are the names of the block output ports, and the field values are bioinfo.pipeline.Output objects. These objects describe the output port behaviors. The field names of the output structure returned by the block run method are the same as the output port names.

The Concatenate block Outputs structure has a field named Output, which contains the concatenated data.

Data Types: struct

Function to handle errors from the run method of the block, specified as a function handle. The handle specifies the function to call if the run method encounters an error within a pipeline. For the pipeline to continue after a block fails, ErrorHandler must return a structure that is compatible with the output ports of the block. The error handling function is called with the following two inputs:

  • Structure with these fields:

    FieldDescription
    identifierIdentifier of the error that occurred
    messageText of the error message
    indexLinear index indicating which block process failed in the parallel run. By default, the index is 1 because there is only one run per block. For details on how block inputs can be split across different dimensions for multiple run calls, see Bioinformatics Pipeline SplitDimension.

  • Input structure passed to the run method when it fails

Data Types: function_handle

Object Functions

compilePerform block-specific additional checks and validations
copyCopy array of handle objects
emptyInputsCreate input structure for use with run method
evalEvaluate block object
runRun block object

Examples

collapse all

Create a pipeline.

p = bioinfo.pipeline.Pipeline;

Create a Concatenate block.

catBlk = bioinfo.pipeline.block.Concatenate
catBlk = 
  Concatenate with properties:

       Dimension: 1
      InputNames: [2×1 string]
      OutputName: "Output"
          Inputs: [1×1 struct]
         Outputs: [1×1 struct]
    ErrorHandler: []

Create two lists of filenames, where each list is a 1-by-2 array.

list1 = ["random.fastq","arbitrary.fastq"]
list1 = 1×2 string
    "random.fastq"    "arbitrary.fastq"

list2 = ["testdata.fastq","example.fastq"]
list2 = 1×2 string
    "testdata.fastq"    "example.fastq"

Set the value of each input of the block.

catBlk.Inputs.Input1.Value = list1;
catBlk.Inputs.Input2.Value = list2;

Add the block to the pipeline.

addBlock(p,catBlk);

Run the pipeline and get the results.

run(p);
combinedList = results(p,catBlk);

By default, the Concatenate block combines the input data using dimension 1, that is, it combines data vertically.

combinedList.Output
ans = 2×2 string
    "random.fastq"      "arbitrary.fastq"
    "testdata.fastq"    "example.fastq"  

Change the dimension to 2 to combine data horizontally.

catBlk.Dimension = 2;
run(p);
combinedList = results(p,catBlk);
combinedList.Output
ans = 1×4 string
    "random.fastq"    "arbitrary.fastq"    "testdata.fastq"    "example.fastq"

Version History

Introduced in R2026a