Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

by a mistake I have deleted the nb file by which the CDF was generated.

All required definitions were in one cell. If I remember the code looked like this:

  Dynamic[ ParametricPlot[..,Initialization:>{functions definitions}]]]

and later I selected the output cell and saved the selection by: File > CDF Export > Standalone.

I can open the CDF in a text editor but it is highly unreadable and is difficult to extract all the math commands.

share|improve this question
Opening in Mathematica just gives the graphics with controls and buttons and no cells to edit. Using Import[] gives the same what I see in the text editor. – sebqas Jun 2 '14 at 8:42
You should not open CDF in text editor. You can easily corrupt it. As Kuba said, the code should still be in the CDF. You might have a cell set as closed and it needs to be opened that is all. If you put the CDF file somewhere, someone might be able to help better. – Nasser Jun 2 '14 at 15:42
Open the .cdf in Mathematica. Then "save as" in the notebook .nb format. Now read it back into Mathematica. If it is not immediately visible, select all then enter and the cell will open as it executes. – bill s Jun 2 '14 at 17:13
I did it at first, but the notebook look the same like pure CDF and has no cells to edit or to convert to anything. – sebqas Jun 3 '14 at 10:23
@Kuba but I have NO output cell when I open CDF file (or the notebook (*.nb) obtained by "save as" on the CDF) – sebqas Jun 3 '14 at 10:32
up vote 6 down vote accepted

Open your cdf in Mathematica. Then open new Notebook and evaluate:

Select[Notebooks[], ("DocumentType" /. NotebookInformation[#]) =="CDF" &
      ][[ 1]] // NotebookGet // NotebookWrite[EvaluationNotebook[], #[[ 1]]] &

SelectionMove[EvaluationNotebook[], Previous, CellContents]

              RowBox[{"InputForm", "[", "\[SelectionPlaceholder]", "]"}]]

SelectionMove[EvaluationNotebook[], All, CellContents]

share|improve this answer
+1 Nice. It should give the OP at least some of the code. Code that evaluated (e.g., outside of Dynamic) might be irrecoverable. – Michael E2 Jun 3 '14 at 11:29
@MichaelE2 Thanks and I agree. :) – Kuba Jun 3 '14 at 11:32
You are great! I got exactly what I wanted. All parts are exactly the same like in my lost notebook. Many thanks /Dzięki/ – sebqas Jun 3 '14 at 12:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.