% NAMELIST takes in a long input string and organizes that string into a matrix where
% each row of that matrix contains a piece of the string inputed. Thus, if one wanted to
% organize the letter of the alphabet into a matrix which can be more easily accessed by
% Matlab, one would input the string 'a\b\c\d\'; and the output would be
% output = a
%          b
%          c
%          d
%
% Use of function:
%
% outsrting = namelist(instring);
%
% instring = horizontal list where each element is separated by a '\'.
% 
% The function returns:
% outstring = a matrix where those string elements are organized into rows
%

function outstring = namelist(instring);

[l,w] = size(instring);

ind = zeros(1,64);
cur_name = [];
for i = 1:w

	cur_char = instring(i);

	if ~strcmp(cur_char, '\')
       
		cur_name = [cur_name cur_char];
	end

	if strcmp(cur_char, '\');
		
		eval(['name' int2str(i) ' = cur_name;']);
		cur_name = [];
		ind(i) = i;
	end
end

ind = find(ind~=0);

[l,w] = size(ind);
for i = 1:w

	num = ind(i);
	eval(['cur_name = name' int2str(num) ';']);
	cur_name = [cur_name '          '];
	cur_name = cur_name(1:10);
	list(i,:) = cur_name;
end

outstring = list;
