text file format problem

David McFarlane mcfarla9 at msu.edu
Thu Apr 19 20:24:08 UTC 2012


Karin,

Thanks for the files, this made a nice little 
puzzle to solve.  The problem seemed pretty 
obvious to me once I looked at it, but here is 
the clue:  Life gets better when you have a 
professional quality text editor, and know how to 
use it (I have used EditPad Pro for years 
(http://www.editpadpro.com ), but you can find many other good ones).

Using EditPad Pro, I could look at the raw 
hexadecimal codes in the file, but I really did 
not have to go that far.  I needed only to enable 
"Visualize Spaces", which also showed me all the 
tab characters in the file.  Voilà!  There, at 
the end of every one of your data lines, was an 
extra tab character (i.e., in Unix/C, an extra 
\t).  E.g., with that encoding, your first full data line looks like

1\t[stimulus0]\t0\t0\tno\t

but should look like

1\t[stimulus0]\t0\t0\tno

i.e., without the extra tab (\t) at the end.  As 
you have found out, E-Prime cannot handle those 
extra tab characters at the end!

So the solution is just to fix your MATLAB 
program so that it does not add a \t to the end 
of your data lines.  And yes, you still should 
use the fopen 'wt' flags, or explicitly end each 
line with \r\n, to comply with PC text file conventions.

BTW, I also tweeted this solution to my 
@EPrimeMaster Twitter feed.  I have been tweeting short solutions all day!

Regards,
-----
David McFarlane
E-Prime training 
online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter:  @EPrimeMaster (twitter.com/EPrimeMaster)


At 4/19/2012 03:34 PM Thursday, David McFarlane wrote:
>I rarely look at people's files, but this looks 
>interesting enough that I would like to take a 
>crack at it.  Please send me your problem .txt 
>file -- just to me, *not* to the whole group!  Thanks.
>
>-- David McFarlane
>
>
>At 4/19/2012 03:24 PM Thursday, you wrote:
>>Hello all,
>>
>>This is a copy of a post that I recently added to the forum on PST's
>>website.
>>
>>I am in a situation in which I need to create a large number of
>>unique, predetermined stimulus sequences for each subject in a study.
>>I am relying on a matlab script to create these sequences; it would be
>>very hard to create them on the fly in E-Prime. So, I am generating
>>the sequences using matlab, having matlab write out the properly-
>>formatted text files, and telling E-Prime to use these text files to
>>populate the relevant List Objects.
>>
>>Here's the problem: When I try to run an E-Prime program that calls to
>>these files, it crashes out entirely -- which is to say, not only does
>>the experiment self-abort, but E-Studio closes, and I get a message
>>regarding this from Windows.
>>
>>What's even stranger is that if I take those same matlab-generated
>>text files, open them in Excel (including the run through the
>>conversion wizard), and then re-save them with the same .txt extension
>>-- then suddenly everything works fine. So it is true that I have
>>something of a workaround, but it is one that involves a tedious, time-
>>consuming step that is potentially prone to human error (opening and
>>re-saving all those files). So, it would be nice to get my matlab-
>>generated files to work.
>>
>>I thought I had found the solution with the following matlab help
>>page:
>>http://www.mathworks.com/support/solutions/en/data/1-15HVX/index.html?product=ML&solution=1-15HVX
>>
>>I tried both their 'wt' option and their '/r/n' solution, and while
>>both did successfully make my text files more Notepad-friendly, they
>>still resulted in the same crashing of the E-Prime program.
>>
>>Thoughts?

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list