extract same row from multiple matrices

조회 수: 5 (최근 30일)
Sabine
Sabine 2012년 11월 26일
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
Sabine
Sabine 2012년 11월 29일
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 2012년 11월 29일
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.

댓글을 달려면 로그인하십시오.

답변 (2개)

per isakson
per isakson 2012년 11월 29일
Your matrix, M, is 50MB. Try
M1 = M( :, [ 1 : 100 : 30000 ] );
  댓글 수: 4
Jan
Jan 2013년 1월 7일
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 2013년 1월 11일
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!

댓글을 달려면 로그인하십시오.


Sabine
Sabine 2013년 1월 11일
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
Image Analyst
Image Analyst 2013년 1월 11일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by