gpt4 book ai didi

global-variables - 如何清除或删除 julia 中的全局变量?

转载 作者:行者123 更新时间:2023-12-03 11:36:55 25 4
gpt4 key购买 nike

是否有任何语法类似于 MATLAB 的“clear”,即如果我有一个全局变量“a”。我该如何摆脱它?我如何进行模拟

clear a

最佳答案

在此处查看此问题的最新答案:https://docs.julialang.org/en/v1/manual/faq/#How-do-I-delete-an-object-in-memory%3F
从文档中检索:

Julia does not have an analog of MATLAB’s clear function; once a nameis defined in a Julia session (technically, in module Main), it isalways present.

If memory usage is your concern, you can always replace objects withones that consume less memory. For example, if A is a gigabyte-sizedarray that you no longer need, you can free the memory with A = 0. Thememory will be released the next time the garbage collector runs; youcan force this to happen with gc().

关于global-variables - 如何清除或删除 julia 中的全局变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22647105/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com