extract same row from multiple matrices

5 visualizaciones (últimos 30 días)
Sabine
Sabine el 26 de Nov. de 2012
Hi, I have collected data from approx. 100 participants in my study where each row corresponds to (x-axis coordinates only) mouse movements of a particular stimulus. I would like to automate the extraction of the data from all matrices for each row into a new matrix, i.e. all row1s of the 100 matrices end up in Matrix1, all row2s end up in Matrix2 etc.
1. all files are labeled path_person_[# of participant].mat, e.g. path_person_3.mat for participant 3.
2. only extract data from every 100th column (there are 30,000 columns)
3. all files are in the same folder.
How can I achieve that? Thank you!
  4 comentarios
Sabine
Sabine el 29 de Nov. de 2012
sorry for the late reply, I was waiting for an email... so when I enter whos x in the command window, it comes back empty (I am using the student version)even though I opened my data file in the variable editor. My matrix is a 196 x 30,000 double matrix and the data in each cell is the coordinate of the mouse movement on the x-axis (y-axis coordinates were fixed), i.e. integers such as "640" "642" etc. all the way to the edge of the screen, depending on the movement. 196 = the number of my stimuli, 30,000 the sampling during the mouse movement in the course of 3 sec. Finally, I currently have data from 80+ participants. Thanks for your help and sorry for my rudimentary understanding of programming!
Sabine
Sabine el 29 de Nov. de 2012
Oh, and my request to extract only part of the data is because I don't think I need that many data points to analyze the hand movement of my participants, i.e. ultimately I want to analyze the start time/reaction time of the mouse movement, direction (i.e. to the left or right of the midpoint of "640") and average and peak velocity of the movement, and finally time of end of movement.

Iniciar sesión para comentar.

Respuestas (2)

per isakson
per isakson el 29 de Nov. de 2012
Your matrix, M, is 50MB. Try
M1 = M( :, [ 1 : 100 : 30000 ] );
  4 comentarios
Jan
Jan el 7 de En. de 2013
I do not have the impression that the email notifications are reliably. Sometimes I get 8 notifications in some minutes from the FileExchange, then no further messages for the next year. Comments to the question do not trigger a notification (or at least did not), although this is important.
Sabine
Sabine el 11 de En. de 2013
Thanks for answering my "complaint" about not getting emails. I will check every few days now.
However, the more pressing questions I had were these: so I activated th file with my participant data and entered the above code into the command window and nothing happened. How do I tell matlab that I want it to access all path_person_[# of participant].mat files and extract a particular row. The above code comes back with "??? undefined variable M."
Also, where does the above line put the data? What will be the name of the file? Will it be saved in the file where I have the original data? Will I have to go through the program 196 times to extract the data for all my stimuli one by one, changing the row #? Thanks!

Iniciar sesión para comentar.


Sabine
Sabine el 11 de En. de 2013
Ok, I think I've been using the system incorrectly - I kept commenting on answers rather than posting my questions under "answers".
First, thanks for answering my "complaint" about not getting emails. I will check every few days now.
However, the more pressing questions I had were these:
I activated the file with my participant data and entered the above code into the command window and nothing happened. How do I tell matlab that I want it to access all path_person_[# of participant].mat files and extract a particular row. The above code comes back with "??? undefined variable M."
Also, where does the above line put the data? What will be the name of the file? Will it be saved in the file where I have the original data? Will I have to go through the program 196 times (once for every stimulus) x 80 times (number of participants) to extract the data for all my stimuli one by one, changing the row #? Thanks!
  1 comentario
Image Analyst
Image Analyst el 11 de En. de 2013
You were using it correctly (until now). What you posted here is not an answer to your original question, is it? No, so it should either be a comment to someone who answered your question, or an edit of your original question to clarify it. If you don't get emails when comments are added, then that is a deficiency of the forum. Regardless, questions are often answered quickly here - in minutes or hours - so you should check back frequently for updates.

Iniciar sesión para comentar.

Categorías

Más información sobre Install Products en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by