Question

MATLAB CODE P#5. In a group of N students (male and female), write pseudocede to count the number of male that pass or fail t
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Considering external file provided by instructor is named as StudentInfo.txt. A sample of this file values are shown below:

M 62
F 49
M 40
M 60
M 69
F 97
F 69
M 34
M 56
M 80

Matlab code is given below:

disp('* Reading Student info *');
%% Reading student information
file=['StudentInfo.txt']; % StudentInfo.txt is the external file provided by the instructor
fid = fopen(file, 'r');
Count=0; % Initialize Count variable which stores number of males passed in exam

input = textscan(fid, '%s %d');
nWords = length(input{1}); %total Number of Students(N)
PassMarks = 60;

for j=1:nWords
    Gender = char(input{1}(j));
    ActualMarks = input{2}(j);
    if (Gender == 'M' && ActualMarks>=PassMarks)
        Count=Count+1;
    end
end

count %Print Number of Males passed.

.................................................................................................................................................

Note: Copy the values of StudentInfo given above and save them as StudentInfo.txt. Copy pasteThe Matlab code it will work fine. ScreenShot of matlab promt is given below.

Feel free to ask if any doubt.

Add a comment
Know the answer?
Add Answer to:
MATLAB CODE P#5. In a group of N students (male and female), write pseudocede to count...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In a group of N students (male and female), write pseudocode to compute the percentage of...

    In a group of N students (male and female), write pseudocode to compute the percentage of female that pass or fail the course. The passing score is 60 or greater. Hint: a variable, say G (as in gender) should store one of two possibilities, ‘M’ (as in ‘male’) or ‘F’ (as in ‘female’), inputted by the user.

  • 5. The Success Academy is organizing an event for its students. Write a Python program that...

    5. The Success Academy is organizing an event for its students. Write a Python program that prompts the user to enter the student's age and gender. The program should then display the day and time for the event registration based on the table below: Gender Registration Monday, 10:00am- 12:00pm Tuesday, 9:00am-12:00pm Wednesday, 9:00am-12:00pm Age Below 10 years old 10 years old and above Male Female Write a Python program that prompts the user to enter his/her monthly weight for the...

  • 4. Write a Matlab code that computes the Reynolds number, discharge coefficient, in the discharge...

    4. Write a Matlab code that computes the Reynolds number, discharge coefficient, in the discharge coefficient, and air flow rate for a given orifice plate geometry an difference. Your code should be able to compute the flow rate (mass and ΔΡ across an orifice plate. You will continue to use your code for the rest example set of data against which you can test your code is provided in from your code must be in the same units as shown...

  • DATABASE SYSTEMS Project INDIVIDUAL WORK DELIVERABLE #: SUBMISSION DATE No Group Work Allowed Apr...

    DATABASE SYSTEMS Project INDIVIDUAL WORK DELIVERABLE #: SUBMISSION DATE No Group Work Allowed April 8 Introduction to Coursework You have been approached by a University for the design and implementation of a relational database system that will provide information on the courses it offers, the academic departments that run the courses, the academic staff and the enrolled students. The system will be used mainly by the students and the academic staff. The requirement collection and analysis phase of the database...

  • c++ implement a student class Determine the final scores, letter grades, and rankings of all students...

    c++ implement a student class Determine the final scores, letter grades, and rankings of all students in a course. All records of the course will be stored in an input file, and a record of each student will include the first name, id, five quiz scores, two exam scores, and one final exam score. For this project, you will develop a program named cpp to determine the final scores, letter grades, and rankings of all students in a course. All...

  • // READ BEFORE YOU START: // You are given a partially completed program that creates a...

    // READ BEFORE YOU START: // You are given a partially completed program that creates a list of students for a school. // Each student has the corresponding information: name, gender, class, standard, and roll_number. // To begin, you should trace through the given code and understand how it works. // Please read the instructions above each required function and follow the directions carefully. // If you modify any of the given code, the return types, or the parameters, you...

  • In C++, Step 1: Implement the Student Class and write a simple main() driver program to...

    In C++, Step 1: Implement the Student Class and write a simple main() driver program to instantiate several objects of this class, populate each object, and display the information for each object. The defintion of the student class should be written in an individual header (i.e. student.h) file and the implementation of the methods of the student class should be written in a corresponding source (i.e. student.cpp) file. Student class - The name of the class should be Student. -...

  • I need this in C++. This is all one question. Introduction Your eighth assignment will consist...

    I need this in C++. This is all one question. Introduction Your eighth assignment will consist of two programs, which will involve the use of simple classes. The source code for these problems should be submitted using the naming conventions we specified in class. Please note that your computer programs should comply with the commenting and formatting rules as described in class. For example, there should be a header for the whole program that gives the author's name, class name,...

  • Need code written for a java eclipse program that will follow the skeleton code. Exams and...

    Need code written for a java eclipse program that will follow the skeleton code. Exams and assignments are weighted You will design a Java grade calculator for this assignment. A user should be able to calculate her/his letter grade in COMS/MIS 207 by inputting their scores obtained on worksheets, assignments and exams into the program. A skeleton code named GradeCompute.java containing the main method and stubs for a few other methods, is provided to you. You must not modify/make changes...

  • Develop an interactive program to assist a Philosophy professor in reporting students’ grades for his PHIL-224.N1...

    Develop an interactive program to assist a Philosophy professor in reporting students’ grades for his PHIL-224.N1 to the Office of Registrar at the end of the semester. Display an introductory paragraph for the user then prompt the user to enter a student record (student ID number and five exam-scores – all on one line). The scores will be in the range of 0-100. The sentinel value of -1 will be used to mark the end of data. The instructor has...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT