> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-events-library/rte-latch.md).

# RTE Latch

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-ef84ece658f62b0a93588fdb8dfa9b7e9d838558%2FRTE_latch_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **RTE Latch** block, located in the **RT-EVENTS/Discrete** library, stores the value of the input each time an event occurs on the trigger signal and outputs the last stored value until the next trigger event. The block compensates for events occurring between two samples. You can set an initial output value and choose to latch on the rising, falling, or either edge. To define the initial condition as a block parameter, set Initial condition source to internal and enter the value in Initial Condition.

{% hint style="info" %}
Set Initial condition source to external, an additional input appears.
{% endhint %}

Use the Trigger Type parameter to select which edge (rising, falling, or either) causes the value to be stored.

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-2d763202939dc3a123b8fe5f2ef83984eac736ce%2FRTE_latch_mask.png?alt=media" alt="" width="314"><figcaption></figcaption></figure>

<table><thead><tr><th width="240.4000244140625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Trigger Type</strong></td><td>Select the edge that latches the value: rising, falling, or either.</td></tr><tr><td><strong>Initial condition source</strong></td><td>Specify the source of the initial condition: internal or external.</td></tr><tr><td><strong>Initial Condition</strong></td><td>Value output before the first edge is detected (used when the source is internal).</td></tr><tr><td><strong>Sample Time</strong></td><td>Time interval between samples.</td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="240.4000244140625">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>Input (Double)</strong></td><td>Signal to be latched.</td></tr><tr><td><strong>Trigger (RTE Boolean)</strong></td><td>RTE Boolean trigger signal used to store the input on the selected edge.</td></tr><tr><td><strong>Initial Condition (Double)</strong></td><td>Value output before the first edge is detected (present when Initial condition source is external).</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="241.199951171875">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Output (Double)</strong></td><td>Latched signal.</td></tr></tbody></table>

## Characteristics and limitations

| Characteristic     | Value          |
| ------------------ | -------------- |
| Direct Feedthrough | Yes            |
| Sample time        | Fixed discrete |
| Work offline       | Yes            |
| Dimensionalized    | Yes            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-events-library/rte-latch.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
