This preview shows page 1. Sign up to view the full content.
Unformatted text preview: while ischar(ln) %sets up condition ln = fgetl(fh); %sets up terminating condition index = findstr(ln,word); %finds which line the specific word is in if ~isempty(index) %if the index is not empty, this will run [token def] = strtok(ln,'-'); %tokenizes the line where the word is found [def rest] = strtok(def,'-'); %tokenizes again to get the definition by itself if def(1)==' ' %finds the first position in the definition def(1) = ; %removes the space break; %gets out of loop once this is met end end end if isempty(index) %sets up def if the word is not in the text file def = 'Entry Not Found'; end fclose(fh); end e...
View Full Document
This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.
- Spring '08