Matlab crisis

E

Hi Everyone,

I'm hoping that someone can help me. I have a cognitive experiment to write in Matlab, however, I'm failing miserably. I've scoured the Matlab help, several books and the web, but can't seem to find any solution to what I'm sure is an easy problem. I think my major problem is, because I'm new to this, I don't know a) whether the things I'm trying to do are possible and b) what the processes are called to be able to find help.

I have a series of .bmp (or .jpg) images. I need to display an image (e.g. type A), the participant makes a keypress to progress, then display another image (e.g. type B), then the participant makes a response indicating whether pictures A and B 'matched', then I display whether their response was correct or incorrect. There are a series of type A and B images, so I have to randomise these. I also want to measure the reaction time difference between congruent and incongruent stimuli.

I haven't really got off the starting blocks yet - despite hours of reading. The problem I have is how to display the images. I've looked at the Psychtoolbox but can only make a blank screen appear. So, I figured I'd just use the standard Matlab command script.

Anyhow, what I have is completely disjointed. I've used the imread/imshow commands, which makes the picture appear, however, the image is displayed as a figure in a new window, in front of the Matlab platform. Plus, where I would display 'correct' or 'incorrect' (after their response) appears in the command window. Really, what I need is the whole thing to appear on its own - with no Matlab things behind it (i.e. the icons, menus etc). Effectively, someone needs to sit in front of it, do their stuff (without being able to see the programming), then I collect their response (plus an RT).

Can anyone point me in the right direction as to what I'm doing wrong? Or what it is called that I'm trying to do? I've found loads of stuff on creating images, but I can't find help on simply displaying ready-made stimuli.

Hope someone can help. I'm so frustrated.

Happy 2009!

B

It's quite simple what you want to do. You can do that using GUI programming in Matlab. Please read it up if you haven't.

How you determine matched or no-matched. Do you need Matlab to do that (i.e comparing images) or you have that already with your series of images.

Anyway, if you explain in detail what you want to do (with examples) I might put up something for you.








E

Hi Bovp2000,

thank you for your reply.

I haven't looked at GUI programming so I'll look that up, thank you! All I kept coming across was using either the Screen commands (which were impossible at my early stage in learning) and 'imshow' .

I don't need Matlab to determine matched or no-matched - I just need the programme to know when the randomised sequence of type A and type B images is matched, so that the users input can be determined as correct or incorrect. I'm assuming that this will be some sort of 'If' type function. I thought it would be best to set up a programme that will simply display my images first before tackling this bit!

Strictly speaking, the images depict a scenario - for example, a coloured box on a chair from two different orientations (type A and type B). The user has to identify whether they match (i.e. a blue box on a chair, followed by a blue box on a chair) or don't match (a blue box...followed by a red box). The user will provide a response stating whether they 'match' or not, then I want some text to appear to tell them whether they were correct or not.

I then want to compare reaction time differences between matched and unmatched stimuli - which I've found using the tic/toc command.

Any advice on the commands to look up would be great. I need to learn this stuff myself, but a prod in the right direction is great.

H

Do you have to really use matlab for this? I would avoid programming in matlab unless I have lots of complicated data/plots etc to generate.

E

Hi H,
sadly yes. It's something my supervisors want me to do - an exercise for someone in the early stages I suppose.

B

Don't worry. Just do it step by step.

I found the following tutorial is useful which will help you to learn


1. How to use GUI
http://blinkdagger.com/matlab/matlab-gui-graphical-user-interface-tutorial-for-beginners
- Display message on the interface rather than command line
- Get information from user
- Using callback function (what you want to do when user click on button)

2. What other options in GUI
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/creating_guis/f10-998412.html
- Learn how to display images in panel. In your case you need two panels. (Check panel component)

I think that all you need to create your program. The rest is as you said using if ... That you can do after you learn how to display two images.

E

That site looks like just what I need - it's hard when you don't know where to start, so thank you again for all of your help

:-)

C

Mmmm Matlab, my poor brother had to code in it for his MSc,..... haven't heard from him since :P.

Are you a programmer or have a programming background? I only ask because no doubt you will want to make the test as fair and accurate as possible and as inherently comes with programming there is always something that goes unnoticed until the very end of the experiment, then you do notice it and it ruins your results lol, speaking from experience anyway ;).

For example it loks like you want to time how long it takes to get an answer, loading differant pictures may take longer to load then others effecting the response time, though i doubt it would be anything noticable but who knows eh :).

Regards Wolfe

E

Hi Cdrwolfe

wish I was a programmer - it would make life a lot easier. I wonder if, like your brother, I'll never be heard from again after this....

Thank you for highlighting those problems. It seems to be rather a tricky thing they have given me. Well, for the novice anyway. I know that the Psychtoolbox is really what would handle this best (from a point of view of timing, colour constancy etc); however, I can't get to grips with that at all

:-(

11136