Wednesday, May 19, 2010

MATLAB code for Major Minor grouping of students of Dept of EEE, BUET
It's been some time since I joined BUET as a lecturer. Today, we were assigning major and minor topics to students. The assigning process was quite cumbersome and had to be done by hand. In order to automate the process, I wrote a small MATLAB program that can be used to automate the process.

The major minor system of the Dept of EEE is quite simple. Currently, there are 3 major groups and 4 minor groups of the department. Based on decision of BUET Undergraduta Studies (BUGS) there is a maximum number of student per major or minor group. The groups are allocated according to CGPA of the students, and if more students want a particular major group than allowed limit, then students with better CGPA will get more preference.

Any how, I am pasting my program here:
% This program automates creation of major minor list of the students.
% Program was written by Sajid Muhaimin Choudhury, Lecturer, Department of
% EEE, BUET on 19/5/2010


N_maj_max = 60;
N_min_max = 60;
N_std = 180;

%Execute the program once, then open variable editor to edit rawdata and
% paste values from excel, columns are, roll, cgpa, maj_choice 1-4, minor
% choice 1-4. 

%rawdata = [1,2,3,4,5,6,7,8,9,10;4,5,6,7,8,9,10,11,12,5];
rawdata = sortrows(rawdata, -2); %sort according to CGPA
std_roll = rawdata(:,1)
std_cgpa = rawdata(:,2)
std_maj_choice = rawdata(:,3:6)
std_min_choice = rawdata(:,7:10)

std_maj = zeros(N_std,1);
std_min = zeros(N_std,1);
count_maj = zeros(1,4);
count_min = zeros(1,4);
%assign major group according to CGPA. 
for i = 1:N_std
    for j = 1:4
        if count_maj(std_maj_choice(i,j)) < N_maj_max
            count_maj(std_maj_choice(i,j)) = count_maj(std_maj_choice(i,j)) +1;
            std_maj(i) = std_maj_choice(i,j);

%assign minor group according to CGPA
for i = 1:N_std
    for j = 1:4
        if (count_min(std_min_choice(i,j)) < N_min_max) &&  (std_min_choice(i,j) ~= std_maj(i))
            count_min(std_min_choice(i,j)) = count_min(std_min_choice(i,j)) +1;
            std_min(i) = std_min_choice(i,j);

final_result = [std_roll'; std_cgpa' std_maj'; std_min']';

final_result = sortrows(final_result, 1);

Researcher and academician by Trade. Hobbyist webdeveloper, photographer and ametuer musician.


  1. thank you very much, sir. can you please give me information about the criteria that are considered apart from CGPA and their priority ? like, 4/3 or 5/2 ?


Visit My Official Website at BUET

Contact Me
Sajid Choudhury
Dhaka, Bangladesh