Read from txt file
Mostrar comentarios más antiguos
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);
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 23 de Feb. de 2013
0 votos
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 comentarios
Kim
el 23 de Feb. de 2013
Image Analyst
el 23 de Feb. de 2013
Use fgetl() instead of fread().
Kim
el 23 de Feb. de 2013
Image Analyst
el 23 de Feb. de 2013
You've accepted an answer, so I guess it's solved now, and I don't need to answer.
Categorías
Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!