Matlab 版 (精华区)
发信人: ramjet (史努比狗), 信区: Matlab
标 题: Re: mathematica如何读取一个nb文件的结果
发信站: 哈工大紫丁香 (2002年02月28日15:45:02 星期四), 站内信件
haha,我的问题在mathematica的news group上被解决了,以下
给我的回复电子邮件。
If you want to save an expression or a variable into a file, perhaps it is better to use Put (>>) and Get (<<) instead of Save:
In[1]:=
result = Table[Random[Integer, {0, 9}], {100}]
Out[1]=
{9, 1, 1, 5, 4, 3, 4, 4, 5, 2, 6, 0, 3, 2, 9, 6, 8, 1, 5,
9, 9, 2, 4, 8, 7, 0, 9, 5, 9, 1, 6, 1, 7, 8, 7, 8, 3, 5,
2, 2, 3, 3, 7, 4, 8, 7, 3, 3, 1, 5, 1, 5, 6, 0, 9, 4, 5,
3, 2, 5, 0, 5, 2, 2, 4, 5, 1, 9, 8, 0, 9, 4, 7, 4, 1, 8,
9, 9, 8, 9, 9, 0, 3, 2, 8, 4, 7, 6, 0, 7, 7, 9, 6, 0, 9,
2, 3, 3, 9, 5}
In[2]:=
result >> "savedresult";
In[3]:=
<< "savedresult"
Out[3]=
{9, 1, 1, 5, 4, 3, 4, 4, 5, 2, 6, 0, 3, 2, 9, 6, 8, 1, 5,
9, 9, 2, 4, 8, 7, 0, 9, 5, 9, 1, 6, 1, 7, 8, 7, 8, 3, 5,
2, 2, 3, 3, 7, 4, 8, 7, 3, 3, 1, 5, 1, 5, 6, 0, 9, 4, 5,
3, 2, 5, 0, 5, 2, 2, 4, 5, 1, 9, 8, 0, 9, 4, 7, 4, 1, 8,
9, 9, 8, 9, 9, 0, 3, 2, 8, 4, 7, 6, 0, 7, 7, 9, 6, 0, 9,
2, 3, 3, 9, 5}
Then you may assign a name to what you just read, like for example
In[5]:=
retrievedfile = %;
Tomas Garza
Mexico City
----- Original Message -----
From: ramjet
To: <mathgroup@smc.vnet.net>
Sent: Tuesday, February 26, 2002 11:48 PM
Subject: [mg33043] How to read in the output of another nb file?
> sorry my question maybe too easy.:-)
> I can use Save[] to store an expression or a variable into a file, and
> use !!filename to display the restored results in a new nb file. But
> they are only displayed and not read into memory indeed. My
> question is how to read the results of another nb file into memory so
> that I can use it as a local variable.
>
【 在 ramjet (史努比狗) 的大作中提到: 】
: 如果我使用一个nb文件计算得到一个表达式,
: 现在想在另外一个文件中使用这些结果.
: 再matlab中可以使用save得到一个mat文件,然后load
: 可是再mathematica中save变量到文件之后,只能使用!!符号显示
: 结果,却不能读入内存,有什么好办法呢?
--
在这个时代
如果你要为社会做一点贡献的话
那么就想办法
让你和你爱的人
好好的活着
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.237.3]
※ 修改:·ramjet 於 02月28日15:46:50 修改本文·[FROM: 202.118.237.3]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:4.148毫秒