Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
GUI psychology experiment

Subject: GUI psychology experiment

From: Catalin Eberhardt

Date: 12 Jan, 2011 17:17:04

Message: 1 of 6

Hi everybody,

I would like to program a psychology experiment that measures how people map numbers to space. The task would be as follows: two numbers (e.g. -10 and 10) mark the extremities of a line, which is constant from trial to trial; a series of numbers appear one by one in the upper part of the screen, and the participant has to click on the line where they think that number should be (so, for instance, the number 1 would require a click a little to the right of the line's midpoint, if the line goes from -10 to 10).

A colleague had programmed this task in Matlab, using BMP files that included both the line and the number to be mapped. Obviously, this is not ideal, since any small change you'd need to make - such as to the values at the extremities of the line, or to the particular numbers to be mapped - becomes a very difficult task, i.e. you'd need to create many BMPs rather than making a few simple edits to some variables in the code.

Making this code quite flexible (i.e. not with BMPs) would also help later on, when I might need to use this paradigm a bit differently, for example having the number line tilted by a number of degrees.

Unfortunately I have never used Matlab to create anything in graphical/GUI mode before. Can anyone suggest what would be a good way to start programming this, and whether you think Matlab or E-Prime would be better suited for this? Many thanks in advance!

Subject: GUI psychology experiment

From: Husam Aldahiyat

Date: 12 Jan, 2011 18:07:05

Message: 2 of 6

(Cheap plug)

Check this:

http://www.mathworks.com/matlabcentral/fileexchange/25603

And maybe these:

http://www.mathworks.com/matlabcentral/fileexchange/23230-master-gui-with-ease
http://www.mathworks.com/matlabcentral/fileexchange/25856

Subject: GUI psychology experiment

From: Sean de

Date: 12 Jan, 2011 18:12:04

Message: 3 of 6

"Catalin Eberhardt" wrote in message <igknmg$3vn$1@fred.mathworks.com>...
> Hi everybody,
>
> I would like to program a psychology experiment that measures how people map numbers to space. The task would be as follows: two numbers (e.g. -10 and 10) mark the extremities of a line, which is constant from trial to trial; a series of numbers appear one by one in the upper part of the screen, and the participant has to click on the line where they think that number should be (so, for instance, the number 1 would require a click a little to the right of the line's midpoint, if the line goes from -10 to 10).
>
> A colleague had programmed this task in Matlab, using BMP files that included both the line and the number to be mapped. Obviously, this is not ideal, since any small change you'd need to make - such as to the values at the extremities of the line, or to the particular numbers to be mapped - becomes a very difficult task, i.e. you'd need to create many BMPs rather than making a few simple edits to some variables in the code.
>
> Making this code quite flexible (i.e. not with BMPs) would also help later on, when I might need to use this paradigm a bit differently, for example having the number line tilted by a number of degrees.
>
> Unfortunately I have never used Matlab to create anything in graphical/GUI mode before. Can anyone suggest what would be a good way to start programming this, and whether you think Matlab or E-Prime would be better suited for this? Many thanks in advance!

A few hints:
-Play with the plot markers etc. to draw your line.
-Use ginput to recover where the person thinks it is based on a mouse click.

%Example
plot([-10 10],[0 0],'b','linewidth',20)
msgbox('Select where you think 2 is');
[x y] = ginput(1);
x

Obviously you'll want to turn off the x and y ticks etc...

Subject: GUI psychology experiment

From: Paulo Silva

Date: 12 Jan, 2011 22:11:04

Message: 4 of 6

I made and uploaded to File Exchange a GUI that makes what you want (at least part of), it's called LinTestPJ, will be available after being reviewed.

Subject: GUI psychology experiment

From: Paulo Silva

Date: 13 Jan, 2011 14:38:04

Message: 5 of 6

http://www.mathworks.com/matlabcentral/fileexchange/30014-lintestpj

Subject: GUI psychology experiment

From: Catalin Eberhardt

Date: 13 Jan, 2011 20:25:19

Message: 6 of 6

Many thanks indeed Sean! Your few lines of codes were the starting point for the script that I created to do this task.

Paulo, I'm sorry that I only today remembered that I had not thanked the person who had helped me (Sean), so when I came to do this today I also noticed your message and the script that you very kindly created. Your work was not in vain though, because I got a few things from it that improved my own script, so thank you very much!

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us