Matrix manipulation Specific rows and columns
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a huge set of data in an excel spread sheet it is 16 columns A-P and 4800 rows.I need to take the data from column F and H and find where each of them is greater than 10 in the same row. and then sore this information in a variable.
So say I have the 16 columns, I want the 6th column and the 8th column. Once I call those out, I want to find where they each are greater than 10. Once I know where they are greater 10, I need to know where both are greater then ten in the same row. Like row 2000 column F and column H are greater then ten. Once I have the total number that is greater then ten in the same row I then will store them in a variable. Thank You so much.
댓글 수: 0
답변 (1개)
Jos (10584)
2018년 9월 27일
First you need to read in the excel into a regular matlab array. Then use logical indexing to select your data. An example:
DATA = randi(10,10,8) % a small example
tf = DATA(:,3)>5 & DATA(:,6)>5 % where are the values in column 3 and 6 larger than 5
OUT = DATA(tf,[3 6]) % select those values from these columns
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!