## One measure greater than another?

### Rachael Courts (view profile)

on 17 Sep 2019 at 4:56
Latest activity Commented on by Walter Roberson

### Walter Roberson (view profile)

on 17 Sep 2019 at 14:34

### Guillaume (view profile)

Hi All,
I have a 697 x 38 which has different column headings such as 'startf, maxf, etc'.
I'm wanting to check if my measurements are true (an answer of 1 indiciting not true?) such that;
startf>fmax
startf<fmax etc..
Currently, I've sectioned off the columns of interests:
T = PWALLVOCSPARTSOFBIPHON
Wanted = T(:,'SFStartFreqHzoffundamental')
Wanted1 = T(:,'MaxFHzfundamental'
I now want to check if wanted is greater than wanted1
I tried:
Wanted > Wanted1 ans =
but thats just producing an error.
In addition, if the answers were shown to be untrue. Such as I have data of a start frequency that is lower than minimum frequency, how do i find which rows these will be located in?

Walter Roberson

### Walter Roberson (view profile)

on 17 Sep 2019 at 5:30
After you have extracted those variables from the table using {} indexing (important!) then what is class(Wanted) and class(Wanted1) ?
WIth your current code using () then you would be taking a subset of a table and the result would be a table, but {} indexing extracts the contents of a varialbe, and the only way it could be a table as a result is if you have tables stored inside of tables.
Rachael Courts

### Rachael Courts (view profile)

on 17 Sep 2019 at 8:45
THANK YOU SO MUCH! parentheses are definitely important, thank-you for explaining it too.
Okay, so the code works perfectly!
The next step, to retrieve the answer of 0 or 1? then locating within the column what row has the incorrect value?
Any suggestions? :)
Walter Roberson

### Walter Roberson (view profile)

on 17 Sep 2019 at 14:34
find()?

### Guillaume (view profile)

on 17 Sep 2019 at 9:09

Note than an even simpler way to extract data from a table is with dot indexing:
Wanted = T.SFStartFreqHzoffundamental; %equivalent to T{:,'SFStartFreqHzoffundamental'}
Wanted1 = T.MaxFHzfundamental; %equivalent to T{:,'MaxFHzfundamental'}
To keep only the portion of the table for whick mask is true:
Tinvalid = T(mask, :) %Not that this returns a table since we're using () indexing
which can be done in only one line:
Tinvalid = T(T.SFStartFreqHzoffundamental > T.MaxFHzfundamental, :)
If you want to know the row indices, use find:
invalidrows = find(T.SFStartFreqHzoffundamental > T.MaxFHzfundamental)

Rachael Courts

### Rachael Courts (view profile)

on 17 Sep 2019 at 9:21
Hi Guillaume,
Tinvalid =
0×38 empty table
invalidrows =
0×1 empty double column vector
I'm not sure how this shows whether it is a true (1) or false (0), is it the '0' in the '0 x1 empty double column vector' which indicates that all of the outputs are false? (which would be correct as this is a dummy run)
Guillaume

### Guillaume (view profile)

on 17 Sep 2019 at 9:27
Well, yes you've got no invalid rows, so you get empty results. If you indeed had invalid rows, you'd see them.
The number of invalid rows is: