Ask Your Question
0

Save and retrieving my data

asked 2014-02-15 17:36:12 +0100

geo909 gravatar image

I often compute things that take a lot of time. When I stop working, I have to turn off my laptop. When I resume my work later, I'd like to be able to retrieve the previous data, computations, etc. For instance, I have computed a big list and stored it to the variable x. I would like to be able to save my data including the contents of this variable, then when I resume my work, I'd like to be able to have x back.

I tried to save my data to a file mydata.dat via the Data -->Upload or create file menu. Then, I quit sage, ran it again, and tried to link the data file back via the same menu. I got the following:

The data filename already exists in other worksheet Delete the file in the other worksheet before creating a link.

I don't really understand what that means. Then, I tried all of the following:

DATA+'mydata.dat'
open(DATA+'mydata.dat')
DATA=DATA+'mydata.dat'

but in any case, if I type x, I get

NameError: name 'x' is not defined

Could somebody tell me how I should achieve what I'm trying?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2014-02-16 20:24:17 +0100

calc314 gravatar image

You can write the data to a csv file in the DATA directory. I do this regularly with my applications. You can find some code for this at:

http://ask.sagemath.org/question/2154...

edit flag offensive delete link more
0

answered 2014-02-16 04:53:48 +0100

Jeroen Demeyer gravatar image
edit flag offensive delete link more

Comments

Thanks, that's probably what I'd have to go with. However, I was wondering if there is a way to save all the data of a specific worksheet without having to explicitely save every variable to a file. I may have too many of them. Isn't that what the data files were supposed to do?

geo909 gravatar imagegeo909 ( 2014-02-16 12:59:16 +0100 )edit

In particular, note `load`.

kcrisman gravatar imagekcrisman ( 2014-02-16 20:25:23 +0100 )edit

@kcrisman Thanks, but I have the same problem with that; I'd have to save each variable seperately, I may have 100 of them and would like to save the data for the whole worksheet lazily..

geo909 gravatar imagegeo909 ( 2014-02-18 18:56:31 +0100 )edit
0

answered 2014-02-16 20:26:17 +0100

kcrisman gravatar image

Can you use the save_session command?

edit flag offensive delete link more

Comments

1

From a first look, it seems that this is probably what I was asking for in the first place.

geo909 gravatar imagegeo909 ( 2014-02-18 19:05:35 +0100 )edit

Awesome. In that event, don't forget to up vote this and/or accept it, so that others will know it's what you meant.

kcrisman gravatar imagekcrisman ( 2014-02-19 16:00:24 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-02-15 17:36:12 +0100

Seen: 1,337 times

Last updated: Feb 16 '14