Read data from file and print information for whom has the required criteria?
Ältere Kommentare anzeigen
There is a data file with the last name, first name, blood type, - or + Rh factor, and ID number. donors.dat - The data looks like this, for example:
Donald Bird A + 120.1
George Aaron AB - 111.1
Claire Stuart O - 108.1
Jan Doe B + 102.3
Doug Smith AB + 110.5
I need a script that will read the data file and print out all the information for donors whom have the blood type AB.
So the outcome of the script, from the above data should be:
George Aaron AB - 111.1
Doug Smith AB + 110.5
This is what I have so far. What is the problem with my script?
data = 'donors.dat';
FID = fopen(data, 'r');
cn = 0;
if strcmp(data(:,3),'AB') == 1;
cn = cn + 1;
cs{cn}=donors;
disp(donors)
break
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Fortran with MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!