6
$\begingroup$

I have some rather long output from a notebook I run on a remote server. There is a time limit on processes so I typically do NotebookSave[] after any important result. However, some of these results are truncated. I would like to force these (and only these) results to be fully expanded before the notebook saves.

I am aware of the Short command and the option in preferences to define the maximum byte size of output. However, I really do not know how large (in bytes or lines) the output is going to be. (Yes, I could experiment but it seems like there should be an easier way.) I tried Short[%,Infinity] but that didn't work. Any thoughts?

$\endgroup$
6
  • $\begingroup$ I think they are just displayed truncated, but the data is there. It's hard to say without more details. Also I think you mean Short instead of Small. $\endgroup$
    – Ajasja
    Commented May 18, 2012 at 19:18
  • $\begingroup$ Oh, and perhaps it would be better to save the data to a file using Export or DumpSave or similar. $\endgroup$
    – Ajasja
    Commented May 18, 2012 at 19:19
  • $\begingroup$ Indeed, Export like so may work for you. $\endgroup$ Commented May 18, 2012 at 19:25
  • $\begingroup$ Couldn't you just set the preference setting to, say, 75% of your free memory? $\endgroup$ Commented May 18, 2012 at 19:45
  • 1
    $\begingroup$ First, once the kernel quits the hidden data is gone. I too thought it was the FrontEnd just not displaying it all. However, once you quit the kernel you cannot "Show Full Output". Yes, I did mean Short (not sure why I was thinking Small). I could increase the maximum bytes to display but then it's easy to hang the FrontEnd making it try to display something massive. I considered exporting the data but there are multiple results per notebook and I wanted to keep them bundled. Looks like Print is probably what I want. $\endgroup$
    – EricMock
    Commented May 18, 2012 at 22:35

1 Answer 1

5
$\begingroup$

I recommend that you export your data to a file. But having said that, I think that a normal Print will have the same effect as the hypothetical Short[%,Infinity].

For example

(*generate some data*)
data = RandomReal[{-1, 1}, 10^4];
(*This will display truncated*)
data
(*So will this*)
Short[data, 100]
(*This will display all the data*)
Print[data]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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