Answer:
See explaination
Step-by-step explanation:
% open the file to read the data of vote
file_ID = fopen('inp.txt','r');
% Split each line by comma and read data to vector
A=textscan(file_ID,'%s %s %s %s %s','Delimiter',',');
% Initialize variables to count the votes
BS=0;
TC=0;
JK=0;
HC=0;
DT=0;
% Counting first position vote got for each participant
for i=1:29
if A{1}{i}=='BS'
BS=BS+1;
elseif A{1}{i}=='TC'
TC=TC+1;
elseif A{1}{i}=='JK'
JK=JK+1;
elseif A{1}{i}=='HC'
HC=HC+1;
else
DT=DT+1;
end
end
% Assign count variable to array Vote
Vote= [BS,TC,JK,HC,DT];
% Corresponding to each array element give the name
Particpent_name = {'BS','TC','JK','HC','DT'};
% Finding maximum value of array vote
% That person is the winner
[maximum,index] = max(Vote);
str = ['Winner of election is ',Particpent_name{index}];
disp(str)
disp('Vote he got is')
disp(Vote(index))