Read software data files.

2 次查看(过去 30 天)
Zhanhong
Zhanhong 2011-7-5
I'm dealing with various software data files. When I try to open the files in wordpad there are normal English characters and some wired characters, seems they are all ASCII characters with ANSI number from around 200 to 255. Something look like "ÿÿÿÿ". I think the data must be stored in those characters but I don't know how to read those data into MATLAB since I don't have too much experience with data format handling. Thanks for your help.
  1 个评论
Fangjun Jiang
Fangjun Jiang 2011-7-5
What is your data file look like? How do you want to process it? Just read it as string or do you have some numeric data? You need to specify your question. MATLAB can read ASCII value 200 to 255 characters.
>> char(200:255)
ans =
ÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ

请先登录,再进行评论。

回答(1 个)

Rick Rosson
Rick Rosson 2011-7-5
Please try the following:
filename = 'myfile.txt';
txt = fopen(filename,'r');
aStr = fscanf(txt,'%s');
fclose(txt);
ascii = uint8(aStr);
disp(ascii');
HTH.

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by