Reference 〉 Function

Data.getLast(keystr, nint1)

Returns the latest recorded value or values from the model’s data.

Parameters

  • key str, required

    The column title whose data to retrieve. This will be the name registered using data.addReporter().

  • n int, optional

    Number of past values to retrieve. If n=1, the function will return a numerical value. Otherwise it returns a list with values from time t-n to t-1.

    Default value: 1

Return Value num|list[num]|dict

  • If key is a string and n==1 or is not set, returns a number for the last recorded value of the named reporter.
  • If key is a string and n>1, returns a list with the last n values of the named reporter.
  • If key is an integer, returns a dict with lists of the past n values of all reporters.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.