如何在 Octave 中使矩阵(或变量)只读?

发布于 2024-12-23 04:42:57 字数 80 浏览 1 评论 0原文

我使用 fgetl 从 CSV 加载矩阵,并希望确保它不会改变。

设置值后如何使矩阵(或任何变量)只读?

I load the matrix from a CSV using fgetl, and want to make sure that it doesn't change.

How to make the matrix (or any variable) read-only after the values are set?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

合久必婚 2024-12-30 04:42:57

我不使用八度音程,但我看到它现在有类,如果它像在 Matlab 中那样,我就会使用类属性。

来自 matlab 帮助:

"Immutable set access — only the class constructor can set property values.
You cannot change the value of an object property"

我不知道 Octave 与 Matlab 有多少不同,但我读到它们没有太大不同,所以也许你可以看看这是否适用于 Octave。

但是,如果您真的担心数据不会被错误地更改,那么您可以将其保留在磁盘上,并在每次想要处理或查看它时读取它。

除非数据量很大,否则现在这不应该成为问题。

I do not use octave, but I see that it has classes now, if it is anything like In Matlab, i'd then use class property.

From matlab help:

"Immutable set access — only the class constructor can set property values.
You cannot change the value of an object property"

I do not know how much different Octave from Matlab, but I read they are not much different, so may be you can see if this works on Octave.

But if you are really worried about your data not changing by mistake, then you can just leave it on disk, and read it each time you want to process or look at it.

Unless it is huge data, this should not be an issue these days.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文