<p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"> </p><div> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">In this How-To, I would like to explain how to import and present stimuli dynamically using variables and the event system. By using the Labvaned </span><em style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:italic;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Trial System </em><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">one can easily change the type of stimuli (image, text, or video) for each trial. While this is the easiest and fastest way to create trials with various stimuli, it sometimes can be useful to choose an alternative / programmatic way to select stimuli for a given trial/ frame. Here is how you can do this:</span></strong></p> <ol style="margin-bottom:0;margin-top:0"><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Create a variable with data format “array”, and data type “file” (for audio or video data) or “string” or “numeric” for text / numeric stimuli.</span></strong></p></li><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Now click on the folder icon (upload file), for audio or video data you can select multiple files, for text or numeric data 1 (CSV) file. The CSV file will be parsed and the array will be filled up with the comma separated entries.</span></strong></p></li><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">After you press ok you should see the array filled up with values as shown below:</span></strong></p></li></ol><br /><strong style="font-weight:normal"><span style="border:medium;height:333px;overflow:hidden;width:285px"><img height="333" src="https://lh3.googleusercontent.com/2M5deYv_9bUEYQ3MmkBrOA4B5QSgY1pbS_svLo-ye1qkkccB7Tz-EINRNT5b83Pq9y0c9FZzZt4kFdnTFrx_3cEV6XqXKykMg3EpvBUbidJVdF3inhO3g2G1fNReQdP6zv22IggV" width="285" style="margin-left:0px;margin-top:0px" /></span><span style="border:medium;height:339px;overflow:hidden;width:264px"><img height="339" src="https://lh4.googleusercontent.com/I37x4ZgxcbhegQMuQWQ5zh6xDCwTbmmz1c2KQTuMZbTiTakNOwadVllGi60vqPvSPrVryw_NGpytGRvA7i0Qa5B9aiwg9OoiETGnKUXRE94aK7tXkGhO4ofUKyXxjy9l4UH59UaA" width="264" style="margin-left:0px;margin-top:0px" /></span></strong><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">We have now saved the stimuli inside a variable - so next we need to read them out, each trial a new/different. Also we want each subject to see a different order/ sequence of the stimuli.  So the next thing we do is:</span></strong></p><ol style="margin-bottom:0;margin-top:0"><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> Create an event (only once in the introductory task ) with trigger “onFrameStart” and action “ShuffleArrayEntries” for our stimulus array. </span></strong></p></li><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Then we go to the experimental task and create an event to read out a new stimulus for each trial. For this, we create an event with Trigger “onFrameStart” and “SelectFromArray” as an action. For “array variable” we choose our created stimulus array, for index variable we choose the </span><em style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:italic;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">system variable</em><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> “Trial_Nr,” and as output we define a new scalar variable which will hold the single stimulus/file. </span></strong></p></li></ol><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><span style="border:medium;height:162px;overflow:hidden;width:283px"><img height="162" src="https://lh5.googleusercontent.com/uU5gWK5-09XpXRKhNTiIpfZMicz0WVR3hYnD26uMo0FV8gdzUocGEGpZ80CwaOAe9vFBhQU9VXFQhAGurgWODEMEv9PkwPiI6ufifz3X0wHAr0XWqQ1SS9BDc8QHXppG3inUtbXr" width="283" style="margin-left:0px;margin-top:0px" /></span></span></strong></p><ol style="margin-bottom:0;margin-top:0"><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Now to show a (different /selected) value for each trial, first set the “#Trials” (lower left corner) to how many stimuli you want to show (also include some logic to go to the next trial, e.g a fixed frame duration). </span></strong></p></li><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">For showing numbers or text include a text element on your frame and insert the scalar output variable via the red variable insert</span></strong></p></li></ol><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><span style="border:medium;height:124px;overflow:hidden;width:340px"><img height="124" src="https://lh4.googleusercontent.com/BPvwzgIqQyGX-1AfTyqk138eSJzriLHAAZemuHVrCrdgO91gEKw2RpQf-Okpse3xfvEGkqFYMN2vsEvsrliZ2oFPFNvifPiv3zhERXq19kVTHTsKgysxwVFjtAFXIe8JD_X6VRR5" width="340" style="margin-left:0px;margin-top:0px" /></span> </span></strong></p><ol style="margin-bottom:0;margin-top:0"><li style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;list-style-type:decimal;text-decoration:none;vertical-align:baseline;white-space:pre"><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">For images, video, or audio data use the action “setObjectProperty” “Filedata” to and the scalar file output variable (e.g this will determine what image is shown inside the image object):</span></strong></p></li></ol><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><span style="border:medium;height:86px;overflow:hidden;width:314px"><img height="86" src="https://lh4.googleusercontent.com/IjRpVqZmB8KQuxR4tWiZJuZ1cIB72B19P5ucEO3l9X2UxnFjSvvsdTE1TiCEyLdhwIPmink4z3gUUcDtY4nNh2UubCD_GtWwnIv7l4Zza-lxhsL1Oh42deUd_P2uW4UEcWgg3MQw" width="314" style="margin-left:0px;margin-top:0px" /></span></span></strong></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><strong style="font-weight:normal"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:12pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">That’s it. Now you can test/play your study and you should see a new value/stimulus for each trial. To test this on your own feel free to use and import our sample study:</span></strong></p><div><br />Leah Lee</div><div><a href="mailto:Leah@labvanced.com">Leah@labvanced.com</a></div><div><a href="http://www.labvanced.com">www.labvanced.com</a></div><div> </div></div>