Matlab help (psychology dissertation)

I

Hi,

Can anyone help with a Matlab query?

I'm writing up, and have 32 subjects. I now need to do the 'x subjects (x female, mean age y, range x-z) etc, but in Matlab all I can see is age/gender of final participant though I have all other data for all subjects - what I need is a list of subjects' ages and genders.

I asked on Matlab help and did get somewhere - was told it was a loop and given some code - but the person helping was quite impatient with me (perhaps understandably as I'm a rank newbie to Matlab, having to pick it up as I go along with my experiment and there's a lot that doesn't make sense yet) and I didn't get that he was asking me to run the code as new rather than incorporate it into my analysis script. I've tried running it as part of the script anyway just to see but it doesn't like it - get error 'undefined function' - and haven't been told why this is the case as the help guy just said I shouldn't try to use it when I didn't understand what it was doing.

I do get what the code he gave me is doing now, but have no idea how to actually apply it to extract the info from the data I have.

If this makes sense (hot Friday afternoon so it may not) can anyone help/nudge me in the right direction? Can PM the code etc perhaps if that would help. Thanks! And apologies in advance for my slowness re Matlab.

C

I would advise that you use R (here's a good tutorial: http://personality-project.org/r/r.short.html) for the analysis you describe. The most important part IMO is getting the data frame, i.e. data format correctly. E.g. have columns as male, female, etc., and rows as the subjects.

It is possible to do them on Matlab too, but not realistically possible if you don't understand Matlab itself given that you would have to define a lot of your own functions to calculate standard stats analyses measures (well technically there are some, but again, if you are unfamiliar...).

To repeat, R has loads of libraries, and its original focus was for the statistics community so you're more likely to find what you need there. Plus it's free :)

(Aside: I used to use Matlab but now found R much more useful, esp. for statistical analyses. Matlab is good if you are dealing with big matrices, and it does produce some pretty plots. But, I would now say R has caught up in its plotting mechanisms and it's easier for small-medium sized datasets.)

I

Thanks! Everyone keeps telling me R is better and I certainly don't like Matlab for a variety of reasons; I know I'm inexperienced so may be using it wrong but can't help feeling some things are just annoying.

But - I ran the experiment and the analysis in Matlab (because I was using Cogent) - can I now (easily) use R for this when I've already done everything else in Matlab? I do the actual statistical analysis in SPSS - basically get the data I need from Matlab and dump it in SPSS, and thought I could just go in and get the list of Ss direct from Matlab. Apparently not...

C

Wow, people actually use Cogent outside of coursework? :P

Can you export the data as a .csv file? (Or even just .txt) That would be my choice of format. I'd turn to Google for anything more complicated...

However, I'm a bit confused now since you say you use SPSS for analysis, yet you were trying to run a Matlab script to compute stuff like means? Does SPSS not support that? (I haven't used SPSS before, but hear it's the default software in Psychology/Social Sciences.)

I

Apparently...well it kind of IS coursework in a sense (MSc) but I think my supervisor and others use it. Drives me nuts though, because my computer hates using it and sometimes it randomly crashes.

Sorry, I wasn't clear - I can easily calculate the mean etc (hell, can do that in Excel), but I actually need the list of ages and genders for all the subjects first - that's what I can't get out of Matlab, the data itself. I ran the experiment with Matlab/Cogent, then an analysis script to extract the data.

C

Ok, well without looking at what you used to run the experiments exactly, I don't think I can help you :/ Sorry!

It sounds like you need to understand the code you've been given, or at least its structure so you can modify it to export what you need. I had assumed that with each experiment the output was exported to some textfile for analysis.

I

Thanks for trying! Wish I could use R... The output is saved in files for each subject, then the analysis script pulls the data out of those files and arranges them more helpfully. Except for quite possibly the simplest thing ie age and gender.

At this rate it might just be easier to look in all the subject files individually and pull them from there...much as I would like to know what the code is doing.

26762