function s = castringload(fname) %CASTRINGLOAD Reads a carriage return delimited file of strings into a cell array. % castringload(fname) loads the file named 'fname' into memory and places % the set of strings delimited by carriage returns contained in the file % into a one dimensional cell array. % % Written by Finny Kuruvilla v1.0.3 Last Updated 9-6-2000 dl_val = 13; % this delimiting value is valid for most x86 based systems. if ~(exist(fname,'file')) error('this is not a valid file name.'); end fid = fopen(fname,'r'); whole = fread(fid, inf, 'uchar'); fclose(fid); raw = whole'; current_cell = 1; placeholder = 1; s = {}; for k = 1:length(raw) if raw(k) == dl_val s{current_cell} = char(raw(placeholder:(k-1))); current_cell = current_cell + 1; placeholder = k+2; end end s{current_cell} = char(raw(placeholder:length(raw)));