Empirisoft Support

    Welcome to Empirisoft Support
Results 1 to 9 of 9

Thread: Saving multiple responses to txt file using filename (case 6616)

  1. #1
    Join Date
    Aug 2012
    Posts
    4

    Saving multiple responses to txt file using filename (case 6616)

    I've had a look through the forum and I wasn't able to find a solution that fit my problem. I would like to have participants generate stimuli in a MediaLab session that I can subsequently present in DirectRT.

    So far, I've created a questionnaire in MediaLab and used the "Fill-in-the-blank" item type. I've then used the "Filename" feature to save responses to a text file.

    The issue is, I would like all 4 responses to save to a single text file so that DirectRT can randomly display each of the 4 items. However, MediaLab is overwriting each response so that only response 4/4 is being saved to the text file.

    Is there a way to save 4 items into 1 file? Or for DirectRT to call up a text file that draws up information from 4 other text files?

    Thanks in advance!

  2. #2
    Join Date
    Feb 2013
    Posts
    1,093
    Hi Marguerite!

    I think I may be able to help. If MedIaLab is overwriting the fill in the blank answers, I'm assuming you are trying to save them all to the same file name-something like stim.txt. If so and you want DirectRT to randomly present these four MediaLab answers, I would suggest that you would want MediaLab to save the fill in the blanks in 4 separate files. Here is what I would try:

    1) Write each of the four fill in the blanks to its own text file. Let's call them stim1.txt through stim4.txt.

    2) Make an input file for DirectRT with four trials (one line for each of the MediaLab created text files.

    3) In the stim column of each trial, type # followed by the pathway for each different text file. So stim1.txt goex in trial 1, stim2.txt goes in trial 2 and so on.

    4) Randomize the four trials by typing the same number in the RGW column of the input file.

    Please let me know if this helps. If not, I'm happy to help find a solution.

    Cheers!

    Psychboiler

  3. #3
    Join Date
    Jan 2013
    Posts
    34

    saving 4 text responses per person, per row

    Hello.
    Using the settings that you had mentioned, I made a basic example of how to obtain from MediaLab each person's 4 text responses, to later use in DirectRT.

    In the file attached, "example.que" you will see the settings that I used, so that each text response per person is saved in its own column (importantly, not over-written!).

    And, in the byquestionnaire and byvariablename folders created by MediaLab, you can extract each person's text responses, prepare for use in Direct RT. Of course you can choose which output to edit, CSV or TXT.

    Attached is the text file from my example (from byquestionnaire), where each participant's text responses are side by side. Either copy/paste those to new text files (to us as input for DirectRT), or edit the MediaLab text file directly, then Save As a new text file, to be used as stimuli in DirectRT.

    Please let me know if this is your goal or if meant something different.
    Attached Files Attached Files

  4. #4
    Join Date
    Aug 2012
    Posts
    4
    Hi Psychboiler and timdritchie,

    Thanks for both of your suggestions.

    jason_reed - I believe I attempted what you suggested, however when I try to get my experimental cvs file to call up the stimulus.cvs file that i created to call up the individual text files designed by medialab, directrt does not load. Am I supposed to create those trials within the same file and then call up those trials as the stimuli?


    Tim - I believe I've attempted what you suggested, however, it still will not load the stimuli. I have attached my files in case there is something obvious that I am overlooking. It is the stimulus in columns AA and AG that are presenting the problems. Everything else is loading as it should.


    Many thanks again.
    Attached Files Attached Files
    Last edited by jason_reed; 09-02-2014 at 05:06 PM.

  5. #5
    Join Date
    Feb 2013
    Posts
    1,093

    example files to try

    Hi Margerite,

    I've attached some files that show you what I was trying to suggest in my earlier post.

    First, we have to create a folders for MediaLab files and another folder for DirectRT files. Let's call the folder for the MediaLab files Marguerite_ML and the folder for the DirectRT files Marguerite_DRT. You can put them wherever you want, but I like to put the folder for my MediaLab questionnaire and experiment files in the general MediaLab folder and the folder for my DirectRT files in the general DirectRT folder; you'll see this in the pathways in the files I uploaded. Wherever you put the folder for the DirectRT files, create a new folder named "stim"? (no actual quotes in any file names) inside it. You will need it for the answers to the fill in the blank items that will be created in the MediaLab files.

    Open the Marguerite_ex.que file I uploaded in the MediaLab experiment editor. Go into the Details window for the first four fill in the blank items and look at the File Name field. You should see that I put the full pathway name to the stim folder you made in the Marguerite_DRT folder for your DirectRT files. Each of the four fill in the blank items ends with a different .txt file; in this case it's "stim1.txt"? for the first fill in the blank item, "stim2.txt"? for the second fill in the blank item, and so on. Change these pathways to reflect the location on your computer for the stim folder in the Marguerite_DRT folder for the Direct RT files. The easiest way to do this is to find the stim folder, right click it, select "Properties"? and just copy the pathway name in the "Location"? field of the Properties Window. Just paste it in the File Name field and make sure that you type \stim1.txt for the first fill in the blank item, \stim2.text for the second fill in the blank item, and so on. Doing this will make MediaLab record whatever is typed in the box of each fill in the blank item in a separate .txt file in the stim folder. I know it’s not what you originally asked for, but doing it this way prevents any of the fill in the blank items from not being recorded for DirectRT to present.

    You will also notice that the fifth row is of the DirectRT item type with the File Name field containing the full pathway to where to find the Marguerite_ex.csv file (we'll look at this in a second). This will make DirectRT activate right after the last fill in the blank item.

    Now open the Marguerite_ex.csv file I uploaded. You will want to save this file in the Marguerite_DRT folder at the same level as the stim folder. Look at the stim column of the .csv file. Following the instructions from in the Tips and Notes > Miscellaneous Features > Using Responses from MediaLab as Stimuli in DirectRT section of the DirectRT Interactive Users Guide that comes with the Help file of the DirectRT software, you need to type & followed by the name of the .txt file where the answers to the fill in the blank questions were saved. This is why you see &stim1, &stim2, &stim3, and &stim4 It works best when you save them as separate text files in the stim folder that contains the DirectRT input file.

    Now look at the wgr column of the Marguerite_ex.csv file. By putting all 1s in this column, DirectRT will randomly present whatever was typed for the fill in the blank items in MediaLab. You can confirm this by looking at the four log files that I attached. The Stim column shows that I typed four different sets of responses for four different participant numbers, but the Order column shows that they were presented in a randomized order different from the order in which they were entered in MediaLab. You can also see that these stimuli were the fill in the blank answers in the marguerite_ex_MediaLab.csv file.

    To run all of this after you put the Marguerite_ex.que and Marguerite_ex.exp files in the Marguerite_ML folder and the Marguerite_ex.csv file in the Marguerite_DRT folder, just run the Marguerite_ex.que file in MediaLab. I know that this is a long answer, but I hope that this is what you were looking for in your original post. Please let me know if you have any questions.

    Cheers!

    Psychboiler
    Attached Files Attached Files
    Last edited by jason_reed; 09-02-2014 at 05:05 PM.

  6. #6
    Join Date
    Aug 2012
    Posts
    4
    Hi Psychboiler,

    Thank you again for your insight and assistance. The solution you've provided me with has given me a lot to think about with regards to the build of my program.

    I was wondering if there is a way in which to pull up the stim from a single file instead of relying on "&stim1", "&stim2", "&stim3"..and so on. I'm thinking that rather than saving participant responses without overwrite across subjects I would rather just save multiple responses for 1 subject in a file that can be called up for stimuli, and then whether or not those responses are overwritten by a subsequent participant is of secondary concern.

    Is there a way for DirectRT to call up a text file which in turn references another set of text files which contain stimuli?

    so for example DirectRT would call up "stim.txt" which in turn contains reference to draw upon the responses contained in "stim1.txt" "stim2.txt"... I believe timdritchie was pointing me in this direction, but when I include a path to another text file DirectRT seems to think I'm referring to a .bmp file.

    I apologize for not realizing that I was unclear in what I was asking for sooner.

    Many thanks again!

  7. #7
    Join Date
    Aug 2012
    Posts
    75
    Marguerite,

    I think Tim's suggestion would work best if you have a script or other program (or the time to do it manually) that would extract the responses and reformat them in the manner of:

    ~word1
    ~word2
    ~word3

    MediaLab will not create a single file like that automatically. If you are willing to use the multiple file approach, then Psychboiler's approach ought to do it. I do think tho that adding an option to APPEND these responses to the same file make a great deal of sense. Will add that to the to-do list.

  8. #8
    Join Date
    Aug 2012
    Posts
    4
    Thanks! I got it working!

  9. #9
    Join Date
    Feb 2013
    Posts
    1,093
    Hi Margurite,

    That's great to hear! Let us know if there is anything else that we can do.

    Cheers.

    Jason (formerly Psychboiler).

Similar Threads

  1. Assigning multiple styles to a .txt file
    By gh0strider18 in forum DirectRT Older Versions: How Do I...
    Replies: 0
    Last Post: 08-11-2011, 01:36 PM
  2. Why is this .txt file not working?
    By Prosody in forum MediaLab Older Versions: Troubleshooting
    Replies: 0
    Last Post: 11-13-2009, 01:50 PM
  3. Saving data in case of crash?
    By David McFarlane in forum DirectRT Older Versions: General Questions
    Replies: 3
    Last Post: 09-03-2008, 11:01 AM
  4. Saving calculated variables from responses.xls in data files?
    By jarvis24 in forum MediaLab Older Versions: How Do I...
    Replies: 1
    Last Post: 05-27-2008, 07:28 AM
  5. Ignoring the incorrect.txt file for certain trials?
    By jarvis24 in forum DirectRT Older Versions: Troubleshooting
    Replies: 1
    Last Post: 08-23-2006, 10:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •