Second Index Value in Outputs (Simulation)

Tags:
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12292 Score: 0
    Jessica Gibler
    Participant

    I know I can access the first and last values in a list of my items for each sample. You do first(output) or last(output). Let’s say I have a list of 4 values/items in a sample:

    Index 1 = 1

    Index 2 = 2

    Index 3 = 3

    Index 4 = 4

    *1,2,3,4 are labeled as the attribute ‘output’

    To obtain the value for index 1 for all of my samples, I would just type first(output)… this would show as 1 for this specific sample, and to obtain the value for index 4, I would just type last(output)… this would show 4 for this specific sample.

    How can I get it to show the value for index 2 from my items for every sample? So for this sample, it would display ‘2’.

    #12294
    Dan Damelin
    Keymaster

    You can add a filter to many of the functions in CODAP. Here we can use that feature to find the first instance where the caseIndex (a special variable built into CODAP) is equal to 2. The formula would look like this:

    first(output, caseIndex = 2)

    Here’s an example doc showing that.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.