﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 6  » Port code not working, how to add variables to data</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Tue, 16 Jun 2026 08:05:32 GMT</lastBuildDate><ttl>20</ttl><item><title>Port code not working, how to add variables to data</title><link>https://forums.millisecond.com/Topic30378.aspx</link><description>For an experiment I am using the following logic, to display all 5 odors in random order during the 5 different trials. Doing this with text elements also does work, when using this port code, however, only the first odor is presented (so only the first valve [together with the other two valves that that port code opens] is opened). Any idea what I did wrong?&amp;nbsp;&lt;br/&gt;Also I was wondering how to add a variable to the data that displays what odor was presented to the participant during a given try?&lt;br/&gt;Thank you so much in advance!!&lt;br/&gt;&lt;br/&gt;This is the used port code:&amp;nbsp;&lt;br/&gt;&amp;lt;item odor_items&amp;gt;&lt;br/&gt;/ 1 = "01100001"&lt;br/&gt;/ 2 = "01100010"&lt;br/&gt;/ 3 = "01100100"&lt;br/&gt;/ 4 = "01101000"&lt;br/&gt;/ 5 = "01110000"&lt;br/&gt;&amp;lt;/item&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;port all_odors&amp;gt;&lt;br/&gt;/ items = odor_items&lt;br/&gt;/ port = LPT&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;list all_odors&amp;gt;&lt;br/&gt;/ items = (port.all_odors)&lt;br/&gt;&amp;lt;/list&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial rating&amp;gt;&lt;br/&gt;/ ontrialbegin = [trial.rating.resetstimulusframes();&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  trial.rating.insertstimulustime(list.all_odors.nextvalue, 2850)]&lt;br/&gt;/ stimulustimes = [0=port.air; 0=3; 1000=2; 2000=1; 3000=inhale; 5000=port.air]&lt;br/&gt;/ timeout = 5000&lt;br/&gt;/ pretrialpause = 1000&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;(3, 2, 1 and inhale are all text elements, port.air is the same as the port code of item 5 in the item element) &lt;br/&gt;&lt;br/&gt;And here the (working) text code: &lt;br/&gt;&amp;lt;item odor_items&amp;gt;&lt;br/&gt;/ 1 = "Fear1"&lt;br/&gt;/ 2 = "Fear2"&lt;br/&gt;/ 3 = "Neutral1"&lt;br/&gt;/ 4 = "Neutral2"&lt;br/&gt;/ 5 = "Air"&lt;br/&gt;&amp;lt;/item&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text all_odors&amp;gt;&lt;br/&gt;/ items = odor_items&lt;br/&gt;/ fontstyle = ("Arial", 9%, true, false, false, false, 5, 1)&lt;br/&gt;/ position = (50, 65)&lt;br/&gt;/ erase = true(black)&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;list all_odors&amp;gt;&lt;br/&gt;/ items = (text.all_odors)&lt;br/&gt;&amp;lt;/list&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial rating&amp;gt;&lt;br/&gt;/ ontrialbegin = [trial.rating.resetstimulusframes();&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  trial.rating.insertstimulustime(list.all_odors.nextvalue, 2850)]&lt;br/&gt;/ stimulustimes = [0=3; 1000=2; 2000=1; 3000=inhale]&lt;br/&gt;/ timeout = 5000&lt;br/&gt;/ pretrialpause = 1000&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;(3, 2, 1 and inhale are all text elements) &lt;br/&gt;&lt;br/&gt;</description><pubDate>Mon, 14 Dec 2020 16:22:14 GMT</pubDate><dc:creator>Christin41</dc:creator></item><item><title>RE: Port code not working, how to add variables to data</title><link>https://forums.millisecond.com/Topic30387.aspx</link><description>&lt;blockquote data-id="30386" class="if-quote-wrapper" unselectable="on" data-guid="1607962728777" id="if_insertedNode_1607962727278" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="30386" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="30386" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="30386" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 12/14/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-30386"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="30385" class="if-quote-wrapper" unselectable="on" data-guid="1607962728777" id="if_insertedNode_1607956222360" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="30385" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="30385" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="30385" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Christin41 - 12/14/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-30385"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="30379" class="if-quote-wrapper" unselectable="on" data-guid="1607962728777" id="if_insertedNode_1607946651963" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="30379" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="30379" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="30379" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 12/9/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-30379"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;Do&lt;br/&gt;&lt;br/&gt;&amp;lt;port all_odors&amp;gt;&lt;br/&gt;/ items = ("01100001", "01100010", "01100100", "01101000", "01110000")&lt;br/&gt;/ port = LPT&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;instead of using an &amp;lt;item&amp;gt; element.&lt;br/&gt;&lt;br/&gt;&amp;gt; Also I was wondering how to add a variable to the data that displays what odor was presented to the participant during a given try?&lt;br/&gt;&lt;br/&gt;You already have that in the data file, in the stimulusitem and stimulusnumber column pertaining to the port stimulus.&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="30379"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;Thank you for your helpful reply!&lt;br/&gt;&lt;br/&gt;I am unfortunately unable to see the stimulusitem and stimulusnumber columns pertaining to the port stimulus....&lt;br/&gt;&lt;br/&gt;This is the data element that I currently have (with values.reference_odor_item, values.comparison_odor_item and values.is_reference pertaining to another task within the experiment):&lt;br/&gt;&lt;br/&gt;&amp;lt;data&amp;gt;&lt;br/&gt;/ columns = (date time group subject session build blocknum blockcode trialnum trialcode values.reference_odor_item values.comparison_odor_item values.is_reference response correct latency pretrialpause posttrialpause trialduration trialtimeout&lt;br/&gt;stimulusnumber stimulusitem stimulusonset)&lt;br/&gt;&amp;lt;/data&amp;gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="30385"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;With only one set of stimulusnumber/stimulusitem columns, you're only logging the first stimulus displayed by any trial.&lt;a class="if-quote-goto quote-link" href="#" data-id="30386"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;If you don't want to add further stimulusnumber/stimulusitem columns, you can also use &amp;lt;values&amp;gt; of course.&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;...&lt;br/&gt;/ current_odor = 0&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial rating&amp;gt;&lt;br/&gt;/ ontrialbegin = [trial.rating.resetstimulusframes();&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  trial.rating.insertstimulustime(list.all_odors.nextvalue, 2850)]&lt;br/&gt;/ ontrialend = [values.current_odor = port.all_odors.currentindex;]&lt;br/&gt;/ stimulustimes = [0=port.air; 0=3; 1000=2; 2000=1; 3000=inhale; 5000=port.air]&lt;br/&gt;/ timeout = 5000&lt;br/&gt;/ pretrialpause = 1000&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;data&amp;gt;&lt;br/&gt;/ columns = (..., values.current_odor, ...)&lt;br/&gt;...&lt;br/&gt;&amp;lt;/data&amp;gt;</description><pubDate>Mon, 14 Dec 2020 16:22:14 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: Port code not working, how to add variables to data</title><link>https://forums.millisecond.com/Topic30386.aspx</link><description>&lt;blockquote data-id="30385" class="if-quote-wrapper" unselectable="on" data-guid="1607956223485" id="if_insertedNode_1607956222360" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="30385" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="30385" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="30385" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Christin41 - 12/14/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-30385"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="30379" class="if-quote-wrapper" unselectable="on" data-guid="1607956223485" id="if_insertedNode_1607946651963" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="30379" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="30379" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="30379" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 12/9/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-30379"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;Do&lt;br/&gt;&lt;br/&gt;&amp;lt;port all_odors&amp;gt;&lt;br/&gt;/ items = ("01100001", "01100010", "01100100", "01101000", "01110000")&lt;br/&gt;/ port = LPT&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;instead of using an &amp;lt;item&amp;gt; element.&lt;br/&gt;&lt;br/&gt;&amp;gt; Also I was wondering how to add a variable to the data that displays what odor was presented to the participant during a given try?&lt;br/&gt;&lt;br/&gt;You already have that in the data file, in the stimulusitem and stimulusnumber column pertaining to the port stimulus.&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="30379"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;Thank you for your helpful reply!&lt;br/&gt;&lt;br/&gt;I am unfortunately unable to see the stimulusitem and stimulusnumber columns pertaining to the port stimulus....&lt;br/&gt;&lt;br/&gt;This is the data element that I currently have (with values.reference_odor_item, values.comparison_odor_item and values.is_reference pertaining to another task within the experiment):&lt;br/&gt;&lt;br/&gt;&amp;lt;data&amp;gt;&lt;br/&gt;/ columns = (date time group subject session build blocknum blockcode trialnum trialcode values.reference_odor_item values.comparison_odor_item values.is_reference response correct latency pretrialpause posttrialpause trialduration trialtimeout&lt;br/&gt;stimulusnumber stimulusitem stimulusonset)&lt;br/&gt;&amp;lt;/data&amp;gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="30385"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;With only one set of stimulusnumber/stimulusitem columns, you're only logging the first stimulus displayed by any trial.</description><pubDate>Mon, 14 Dec 2020 14:31:23 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: Port code not working, how to add variables to data</title><link>https://forums.millisecond.com/Topic30385.aspx</link><description>&lt;blockquote data-id="30379" class="if-quote-wrapper" unselectable="on" data-guid="1607946652561" contenteditable="false" id="if_insertedNode_1607946651963"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="30379" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="30379" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="30379" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 12/9/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-30379"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;Do&lt;br/&gt;&lt;br/&gt;&amp;lt;port all_odors&amp;gt;&lt;br/&gt;/ items = ("01100001", "01100010", "01100100", "01101000", "01110000")&lt;br/&gt;/ port = LPT&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;instead of using an &amp;lt;item&amp;gt; element.&lt;br/&gt;&lt;br/&gt;&amp;gt; Also I was wondering how to add a variable to the data that displays what odor was presented to the participant during a given try?&lt;br/&gt;&lt;br/&gt;You already have that in the data file, in the stimulusitem and stimulusnumber column pertaining to the port stimulus.&lt;br/&gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="30379"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;Thank you for your helpful reply!&lt;br/&gt;&lt;br/&gt;I am unfortunately unable to see the stimulusitem and stimulusnumber columns pertaining to the port stimulus....&lt;br/&gt;&lt;br/&gt;This is the data element that I currently have (with values.reference_odor_item, values.comparison_odor_item and values.is_reference pertaining to another task within the experiment):&lt;br/&gt;&lt;br/&gt;&amp;lt;data&amp;gt;&lt;br/&gt;/ columns = (date time group subject session build blocknum blockcode trialnum trialcode values.reference_odor_item values.comparison_odor_item values.is_reference response correct latency pretrialpause posttrialpause trialduration trialtimeout&lt;br/&gt;stimulusnumber stimulusitem stimulusonset)&lt;br/&gt;&amp;lt;/data&amp;gt;</description><pubDate>Mon, 14 Dec 2020 12:15:31 GMT</pubDate><dc:creator>Christin41</dc:creator></item><item><title>RE: Port code not working, how to add variables to data</title><link>https://forums.millisecond.com/Topic30379.aspx</link><description>Do&lt;br/&gt;&lt;br/&gt;&amp;lt;port all_odors&amp;gt;&lt;br/&gt;/ items = ("01100001", "01100010", "01100100", "01101000", "01110000")&lt;br/&gt;/ port = LPT&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;instead of using an &amp;lt;item&amp;gt; element.&lt;br/&gt;&lt;br/&gt;&amp;gt; Also I was wondering how to add a variable to the data that displays what odor was presented to the participant during a given try?&lt;br/&gt;&lt;br/&gt;You already have that in the data file, in the stimulusitem and stimulusnumber column pertaining to the port stimulus.&lt;br/&gt;&lt;br/&gt;</description><pubDate>Wed, 09 Dec 2020 18:47:11 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>