function str_out = transtate_str(table_in, table_out, str_in) % Requires: table_in and table_out are columns vectors of strings, % equally long. % Effects: find str_in in table_in, and return its % associated translation in table_out. % Signals error if str_in not found in table. % Ending blanks are ignored. error(nargchk(3,3,nargin)) [rows, cols] = size(table_in); [rows2, cols] = size(table_out); if rows ~= rows2, error('table_in and table_out must have equal # rows')'; end for i=1:rows if strcmp(deblank(str_in), deblank(table_in(i,:))) str_out = deblank(table_out(i,:)); return end end error(['String ' str_in ' not found in translation table']);