function str_out = transtate_str(table_in, table_out, str_in) % Requires: table_in and table_out are columns of strings, equally long. % Effects: find str_in in the first column of table, and return its % associated translation in the second column. % Signals error if str_in not found in table. 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']);