function command_str_matrix = rd_str_file(filename)
% Read strings from file.  File format: one string per row of file.
%  Strings in file are ascii with no quote marks.
%  Stores results in character matrix command_str_matrix, with each
%   (non-blank) row of the file saved as character string that is one
%   row of command_str_matrix.

  % Open filename as read mode text file.
  [file_id, message] = fopen(filename,'rt')
  
  % Check for error opening file.
  if file_id < 0
    disp(message)
    return
  end
  
  % Read file one line at a time.
  command_str_matrix = []
  while 1
    % Read a line from the file.
    line = fgetl(file_id);
    % Check for end of file.
    if ~isstr(line)
      break
    end
    % Found a line.  Extract the string from it.
    comm_str = sscanf(line,'%s')
    % Append the string to command_str_matrix as a new row.
    command_str_matrix = strvcat(command_str_matrix, comm_str)
  end
  
  fclose(file_id);
  
  return

end

