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!