Working backwards from a command window

2 次查看(过去 30 天)
Hey all, I had a strange question that I couldn't find an answer for, perhaps I could get some help here?
A friend of mine was working on an m file for an assignment, and had been executing it to see the results. After deleting the trash on her user account, the m file vanished from the harddrive, but all the outputs from the execution of said m file remained in the command window, which brings me to the question:
Is it possible to use Matlab to work backward from the results in the command window to recover the commands from the m file? Since Matlab was dependent on those commands to generate the output I mean. I also am not looking for an intuitive 'you can see the output, so you can manually discern the m file's contents' type solution.
I hope that makes sense?
--Alex--

采纳的回答

Jan
Jan 2013-4-15
编辑:Jan 2013-4-15
No, this will not work in general.
An exception would be, if a echo on all enabled the display of all processed code during the program runs. But without this there is no chance to use the output to the command window to decide, which code has created this output. Example:
% Command window:
2
% Possible codes:
x = [pi, sin(1.234)];
fprintf('%d\n', length(x))
% Or:
x = clock;
fprintf('%d\n', x(5))
And this is a very trivial example only.
But it would be trivial to reconstruct the deleted file in the leven of the operating system. Deleting does not overwrite the biots on the harddisk, but removes the point in the file system table only.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by