更改后更新(重新加载)mathematica 包 [英] Update (reload) mathematica package after changes

查看:51
本文介绍了更改后更新(重新加载)mathematica 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到以下循环的快捷方式.在开发 mathematica 的包时,正在对 .m 文件的代码进行更改,然后想要在另一个笔记本中测试更改.这是一个无限循环...

I'm trying to find a shortcut to the following loop. When developing a mathematica's package one is implementing changes to the .m file's code and then want to test the changes in another notebook. This is an infinite loop...

所以,我们有一个包 package.m 和一个笔记本 test_package.nb 来完成测试.目前,当我更改 .m 文件中的某些内容时,我必须:

So, we have a package package.m and a notebook test_package.nb where testing is done. Currently, when ever I change something in the .m file, I then have to:

Quit[]
Needs["package`"]

在笔记本中使更改可用,以便我可以测试它们.似乎没有 Quit[] 它不起作用.

in the notebook for the changes to become available, so I can test them. It seems like without the Quit[] it doesn't work.

有没有更短的方法来迭代这个开发循环?特别是避免戒烟?

Is there a shorter way to iterate this development loop? In particular avoid the quitting?

后果

如果可以,我会接受 ruebenko 和 Leonid 的回答,因为两者都有助于解决我的问题.然而,由于只能选择一个答案,我选择了 ruebenko's,因为它简单易用 - 通过简单地将 Needs 更改为 Get 我克服了我的问题.尽管如此,Leonid 的包肯定更复杂,最终可能会产生更好的结果,但必须安装、加载等.

If I could, I'd accept both ruebenko and Leonid's answers as both are helpful and solve my problem. However, as only one answer can be chosen, I picked ruebenko's due to is simplicity and easiness - by simply changing the Needs to Get I overcame my problem. Nevertheless, Leonid's package is for sure more sophisticated and probably at the end of the day yields better results, but it has to be installed, loaded etc.

推荐答案

Use Get;如果根本没有加载,只需要加载包.有时需要小心,对包中的变量使用 ClearAll.

Use Get; Need only loads the package if is not loaded at all. Sometimes you need to be careful and use ClearAll on the variables in the package.

这篇关于更改后更新(重新加载)mathematica 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆