My code can not read a text from text file.

1 次查看(过去 30 天)
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 个评论
Abdullah Alsuhaymi
yeah ,the file I am using is .docx
I am trying to make matlab display all the text inside a text file which format is .docx
I couldnot upload the file because the format .docx is not supported here.
thank you
dpb
dpb 2019-6-1
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Export 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by