p(1).name = 'Jim Brown';
p(1).age = 23;
p(1).grade = 'A';
p(2).name = 'Sarah Finn';
p(2).age = 21;
p(2).grade = 'B';
plen = length(p);

fid = fopen('list1.txt','w');

for ii = 1:plen
    fprintf(fid, '%s, %d, %c\n', p(ii).name, p(ii).age, p(ii).grade);
end

fclose(fid);

fid = fopen('list1.txt');

jj = 0;
while ~feof(fid)
   jj = jj+1;
   st = fgetl(fid);
   rec = strsplit(st, ',');
   q(jj).name = rec{1};
   q(jj).age = eval(rec{2});
   q(jj).grade = strip(rec{3});
end

fclose(fid);

for kk = 1:jj
   fprintf('Name = %s, Age = %d, Grade = %c\n', q(kk).name, q(kk).age, q(kk).grade);
end


