MATLAB: Read from txt file

read txt

I have to 1) Read in a dictionary of common English words from words.txt.
and
2) Read in an email with misspellings from email.txt
in one file
I just started learning matlab and I am a beginner. I did this, but it doesn't work. Help please.
==
==
fip = fopen('words.txt', 'r');
Data = fread(fid);
CharData = char(Data);
fclose(fid);
disp(Data);
fip = fopen('email.txt', 'r');
Data = fread(fid);
CharData = char(Data);
fclose(fid);
disp(Data);

Best Answer

% Try this
fid = fopen('words.txt', 'r');
Data = fread(fid);
CharData = char(Data);
fclose(fid);
disp(Data);
fid = fopen('email.txt', 'r');
Data = fread(fid);
CharData = char(Data);
fclose(fid);
disp(Data);
If not works than what is the error..? Show it..
Related Question