필터 지우기
필터 지우기

Any method to restore garbled/distorted text file?

조회 수: 1 (최근 30일)
JY Su
JY Su 2013년 8월 28일
Dear Sirs:
I got a very weird situation that highly needs your assistance. I appreciate your effort and time in advance.
I have a machine which produces a text file that records some information of the machine's working status such as, the coordinate of the drill head and the rotating speed used at that position. While we examine the text file, it appears to be unreadable because most of the contents are garbled. Please see the attached figure. http://ppt.cc/sA1I
As you can see some part of the file is readable; however many unrecognizable characters, which should be those numeric values we want.
Two reasons that I believe this problem should be solved by Matlab. First, I am sure this machine has many built-in matlab code inside for analysis purpose. Second, we have a .exe file, which is compiled by Matlab, can restore the garbled text file into arranged and readable format (the values of the coordinates are restored).
We desperately want to see the contents of this file by ourselves. Please kindly provide solution or idea or any direction for me to solve this issue.
Sincerely,
  댓글 수: 2
Image Analyst
Image Analyst 2013년 8월 28일
You say "Second, we have a .exe file, which is compiled by Matlab, can restore the garbled text file into arranged and readable format" Do you really have that exe file already, one that can restore your file, or did you misstate that? Is it something you want to develop/build/make, not something you have already?
JY Su
JY Su 2013년 8월 29일
We really have the exe file already and I am sure it is compiled by matlab. However, this exe file is not mine. I want to read this file by myself. Thanks!

댓글을 달려면 로그인하십시오.

답변 (3개)

Iain
Iain 2013년 8월 28일
read the file as binary data, unsigned 8 bit integers.
When you have an unknown symbol, or for some reason you expect a known symbol to be a number, you should take that value, and try seeing what the value is using "typecast" eg.:
n = typecast(uint8([64 1]),'uint16')
n =
16385
n = typecast(uint8([0 0 0 0 0 0 64 1]),'double')
n =
1.1666e-302

JY Su
JY Su 2013년 8월 28일
Thanks for your timely reply!
I am not really familiar to binary format. Please allow me to ask more:
After I use fread('filename','unit8') to import this text file I got a very huge column (102645 by 1). In your opinion I should first identify the location of numbers? It is almost impossible for me since the file is very large and the structure of it is very complicated. There are many many heading and other notations.
Is that possible to read the text file and, somehow, convert it by functions of matlab, to another text file that are totally readable?
Thanks again!!
  댓글 수: 3
Iain
Iain 2013년 8월 28일
If you know the format of the file, then yes, it's easy. You just read things, and change how you read them to get all the info the way you want it, then put it in a string and write it to file. Thats the easy part.
Your job is really to identify the format of the file. It is NOT an easy job unless you can add more information (like a complete description of the file).
Iain
Iain 2013년 8월 28일
I can't see those links - stupid work firewall settinsg.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2013년 8월 28일
On a Unix type system, I would start with using "strings" on the file, and piping that into "uniq". Then I would go through the list of strings produced and remove the ones where it was clear that an extra character or two were spurious. The result should mostly be a set of keywords. Those keywords could be matched against in the text, and a binary value read after that point.
It appears to me that after 'coordinate' there are 8 binary bytes. Those might represent two four-byte values, or one eight-byte value. I do not know the byte ordering at this point; I would need to experiment.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by