MATLAB: For-loop question

forfor loopMATLAB

I am using the readMatrix function to read in 90 rows and 13 columns of data (with each column being a measurement such as age, gender etc) from a .csv file, I then need to perform if statements on this data to follow a decision tree based on the data in each row to give me an outcome. I have been told that using a for loop will help me to implement this decision tree on the data but I haven't been told how?
This is what I have so far
myData = readMatrix('BME501_Coursework_Testdata.csv');
for i= 1:90
Val1 = Column1(1);
Val2 = Column2(1);
Val3 = Column3(1);
Val4 = Column4(1);
Val5 = Column5(1);
Val6 = Column6(1);
Val7 = Column7(1);
Val8 = Column8(1);
Val9 = Column9(1);
Val10 = Column10(1);
Val11 = Column11(1);
Val12 = Column12(1);
Val13 = Column13(1);
end
As you can see I have gotten the file to be read in and then have defined each of the values in row 1 so that they can be used in the decision tree.
My question is how is it possible to do this for all 90 rows so that each row (which is 1 set of data) can be read as one set of data so that the decision tree can use the variables within it to give me an outcome for each row?

Best Answer

myData = readMatrix('BME501_Coursework_Testdata.csv');
for i = 1 : size(mYData,1)
thisrow = myData(i,:);
now use thisrow in your decision tree
end
Related Question