Read from txt file
33 ビュー (過去 30 日間)
古いコメントを表示
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);
0 件のコメント
採用された回答
Lalit Patil
2013 年 2 月 23 日
% 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..
2 件のコメント
Lalit Patil
2013 年 2 月 23 日
CStr = textread('words.txt', '%s', 'delimiter', '\n')
Try this only single line..
その他の回答 (1 件)
Image Analyst
2013 年 2 月 23 日
What doesn't work? You read in two files, and that's what you were supposed to do. So what doesn't work? Please copy and paste your error message or whatever else tells you that it is not working.
4 件のコメント
Image Analyst
2013 年 2 月 23 日
You've accepted an answer, so I guess it's solved now, and I don't need to answer.
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!