HW2 hints for users of octave

(From Stephen Isard)

The following octave code will read the Peterson-Barney file into a cell array in octave. You should edit the first line to reflect the name of the file in your own directory.

fname = 'pb.Table1';
nrows = 1520;
PB = cell(nrows,9);
fid = fopen(fname);
for r = 1:nrows
PB(r,1) = fscanf(fid,'%s',1); PB(r,2) = fscanf(fid,'%s',1);
PB(r,3) = fscanf(fid,'%d',1); PB(r,4) = fscanf(fid,'%s',1);
PB(r,5) = fscanf(fid,'%s',1); PB(r,6) = fscanf(fid,'%f',1);
PB(r,7) = fscanf(fid,'%f',1); PB(r,8) = fscanf(fid,'%f',1);
PB(r,9) = fscanf(fid,'%f',1);
end;
fclose(fid);

Once you have done that, you can create the array of strings MWC with the command

MWC = char(PB(:,1));

after that you can carry on with

isman = (MWC=="m");

and so on.

In creating the VID matrix, replace PB{4} by PB(:,4), getting lines of the form

VID = VID + (strcmp('iy',PB(:,4)));

To create the F0123 matrix, use

F0123 = cell2mat(PB(:,6:9));

after that, I think everything should work as in Mark's notes.