Any method to restore garbled/distorted text file?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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?
답변 (3개)
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
댓글 수: 0
JY Su
2013년 8월 28일
댓글 수: 3
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).
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!