Matrix manipulation Specific rows and columns

2 views (last 30 days)
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.

Answers (1)

Jos (10584)
Jos (10584) on 27 Sep 2018
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

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!