MATLAB: How can I read from file and plot a histogram related to the data

wed

%data
1 %represent the id of the user
john % represent the name of the user
200 % represent the score of the user
2
hanna
1000
3
georges
500
and i want to plot a histogram that represent for each name the score

Best Answer

fid=fopen('sudoku.txt');
tline = fgetl(fid); %skip '%data'
tline = fgetl(fid); %skip empty line
count = 0;
while ~feof(fid)
count = count + 1;
tline = fgetl(fid);
ids{count} = tline;
tline = fgetl(fid);
usernames{count} = tline;
tline = fgetl(fid);
scores(count) = str2double(tline);
end
fclose(fid)