My code can not read a text from text file.
Mostrar comentarios más antiguos
Hi guys
I am asking the matlab to display a text inside a word file and I am using this code but matlab shows the word like this: |]<„g®¾Q;a0طî$¶UڑMکًأKٹS°؛
What is the problem?
fileID = fopen (filename,"rt");
if fileID < 0
error('error opning file %s/n/n',filename)
end
tline = fgets(fileID);
while ischar (tline)
fprintf('%s %c',tline)
tline = fgets(fileID);
end
fprintf('/n');
fclose(fileID);
5 comentarios
Abdullah Alsuhaymi
el 1 de Jun. de 2019
"I am asking the matlab to display a text inside a word file "
What exactly do you mean by a "word file" : are you working with text files (which are not "word files" by any common definition of the term) or are you use Microsoft Office proprietary format such as Open Office XML .docx ? Using correct terminology makes it easier for people to understand what you are asking about and what you are trying to do.
Abdullah Alsuhaymi
el 1 de Jun. de 2019
dpb
el 1 de Jun. de 2019
ML doesn't have builtin Word file reader -- either save the file as plain text from Word or you'll have to use COM to drive Word and that then becomes a Word forum question as to what is the syntax for it, not Matlab at all.
Respuestas (0)
Categorías
Más información sobre Data Import and Export 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!