Student Names and Failed Subjects Calculations
Versione 1.0.0 (1,76 KB) da
Helin Qais
from this code you can calculate student names and subjects failed and how many subjects they have failed.
% Your data
StudentNames = {'John'; 'Alice'; 'Bob'; 'Eve'; 'Ali'; 'Adam'; 'Ben'; 'Sarah'; 'Sebrina'; 'Angela'};
Math = {'85'; '90'; '75'; '60'; '30'; '27'; '100'; '50'; '10'; '77'};
Physics = {'78'; '82'; '88'; '45'; '43'; '90'; '22'; '0'; '88'; '59'};
Chemistry = {'92'; '80'; '70'; '55'; '100'; '56'; '80'; '34'; '60'; '33'};
Biology = {'82'; '90'; '60'; '75'; '99'; '86'; '30'; '32'; '60'; '53'};
Geology = {'62'; '80'; '60'; '35'; '69'; '96'; '30'; '32'; '20'; '23'};
English= {'92'; '98'; '90'; '95'; '89'; '96'; '80'; '72'; '80'; '93'};
MachineLearning = {'62'; '50'; '70'; '25'; '39'; '46'; '80'; '22'; '60'; '53'};
Arabic = {'82'; '90'; '80'; '95'; '99'; '76'; '92'; '62'; '70'; '83'};
P_E = {'92'; '90'; '100'; '95'; '89'; '96'; '90'; '92'; '80'; '93'};
World_Religions = {'82'; '90'; '60'; '75'; '99'; '86'; '30'; '32'; '60'; '53'};
SocialStudies= {'72'; '90'; '80'; '85'; '99'; '26'; '50'; '32'; '10'; '0'};
Art = {'92'; '100'; '100'; '95'; '99'; '96'; '100'; '92'; '90'; '100'};
Humanities = {'92'; '90'; '100'; '95'; '89'; '96'; '90'; '92'; '80'; '93'};
Computer_Technology = {'92'; '90'; '100'; '95'; '89'; '96'; '90'; '92'; '80'; '93'};
Turkmen_Language = {'72'; '80'; '90'; '95'; '79'; '76'; '42'; '52'; '30'; '93'};
Data = table(StudentNames, Math, Physics, Chemistry, Biology, Geology, English, MachineLearning, Arabic, P_E, World_Religions, SocialStudies, Art, Humanities, Computer_Technology, Turkmen_Language);
% Initialize output table
OutputData = table();
% Iterate through each row
for i = 1:size(Data, 1)
% Get the student's name
studentName = Data.StudentNames{i};
% Extract the marks for the current student
studentMarks = table2array(Data(i, 2:end));
% Find subjects where the marks are below a passing threshold (e.g., 60)
failedSubjects = Data.Properties.VariableNames(1 + find(str2double(studentMarks) < 60));
% Count of failed subjects
failedSubjectsCount = numel(failedSubjects);
% Add a row to the output table
OutputData = [OutputData; table({studentName}, failedSubjectsCount, {strjoin(failedSubjects, ', ')}, 'VariableNames', {'Name', 'FailedSubjectsCount', 'FailedSubjects'})];
end
% Display the output table
disp(OutputData);
Cita come
Helin Qais (2024). Student Names and Failed Subjects Calculations (https://www.mathworks.com/matlabcentral/fileexchange/156832-student-names-and-failed-subjects-calculations), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Creato con
R2023b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS LinuxTag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
Versione | Pubblicato | Note della release | |
---|---|---|---|
1.0.0 |