Read software data files.

1 view (last 30 days)
Zhanhong
Zhanhong on 5 Jul 2011
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 Comment
Fangjun Jiang
Fangjun Jiang on 5 Jul 2011
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 =
ÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ

Sign in to comment.

Answers (1)

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

Products

Community Treasure Hunt

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

Start Hunting!