Hello !
(You can read the attached file, under section: 2.1 DATA LOAD FUNCTION , thanks.)
I have written the following code:
function data = dataLoad(filename) %A function that reads a datafile and returns an nx3 matrix, with the acceptet rows. % also returning error messages. %the name of the file that i will use: tgb.csv. data = readtable('tgb.csv');
% for loop that chekcs if the temperature is between 10 og 60. if (10<(tgb(:,1)); disp('Temperature must be between 10 and 60'); elseif (tgb(:,1)<60); continue; end continue; % for loop that checks if the growthRate is a positive number. for (tgb(:,2) < 0); disp('Growth rate must be postive'); continue; end % for loop that identifies the bacteria. for (tgb(:,3) > 4) error('invalid number. The number must be between 1 and 4'); case tgb(:,3) of 1 do return('Salmonella enterica'); of 2 do return('Bacillus cereus'); of 3 do return('Listeria'); of 4 do return('Brochothrix thermosphacta'); continue; end
—————————————————————————————-
That does not Work for me! First this is my 7 matlab problem, and i am new user… So please be patient 🙂
I have to figure out: 1. how to call the matrix, and display the rows that are "true" in a N x 3 matrix. 2. how to make the conditions for ROWS instead of COLOMNS. (That is what i have done) –> Is it something like:
for i = 1:length(data(:,1))-1 % loop gennem alle rækker. if sum(data(i,:))>sum(data(i+1,:)); end end elseif CONDITION
elseif CONDITIONend ???
???
If someone could help me find an easier way or help me with the solution, it will be fantastic,
NOTICE: I only need help with the 2.1 section in the attached file. I have also attached my csv file.
Thanks for your time!
Best Answer