Where I am at;
I have imported a csv file as a table.
Each row of the table holds 14 peices of information (stored as variables in the table) about a person. Age, sex (1 or 0), wether or not they have had previous attention (1 or 0) etc.
For arguments sake here's a table to try and explain what I am talking about; (thanks MATLAB)
Gender Age Location Height
__________ ___ _____________________________ ______
Smith {'Male' } 38 {'County General Hospital' } 71
Johnson {'Male' } 43 {'VA Hospital' } 69
Williams {'Female'} 38 {'St. Mary's Medical Center'} 64
Jones {'Female'} 40 {'VA Hospital' } 67
Brown {'Female'} 49 {'County General Hospital' } 64
From a second set of data I have generated a decision tree which is implemented in ifelse statments - proof of concept and easier explination than higher level methods.
For arguments sake the tree could look something like this;
if (age > 30) && (height <= 70) && (Gender == 1)
fprintf('The patient has identified as positive')
outcome = 'T'
elseif (age > 40) && (height <= 60) && (Gender == 1)
fprintf('The patient has identified as Negitive')
outcome = 'F'
elseif (age > 40) && (height <= 60) && (Gender == 0)
fprintf('The patient has identified as positive (5.08)')
outcome = 'F'
end
What I want to do:
I want to take the data from the import and run it through the decision tree of ifelse statements.
Finally my question.
Is there a way to extract each row from the table (all 14 variables) and run this through the ifelse statements to return the outcome of each row as true or false?
I know I can extract a row of information from a table with ;
I just cant figure out how to process that row with the if else statments, I am assuming each element still is associated with its variable?
Thanks,
Christopher