清除后MATLAB是否保留一些变量? [英] Does MATLAB keep some variables after clearing?

查看:542
本文介绍了清除后MATLAB是否保留一些变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,可以读取非常大的Excel文件并创建一些大变量.如果我尝试连续运行多次,则会耗尽存储空间,这很有意义,即:

I have a program that reads in a really large Excel file and creates some large variables. This runs out of storage if I try to run it multiple times in a row, which makes sense, i.e.:

large_program; large_program

large_program; large_program

将崩溃.但是,我不明白的是为什么

will crash. However, what I don't understand is why

large_program;清除所有; large_program

large_program; clear all; large_program

也将崩溃;为了多次运行它,我必须每次都重新启动MATLAB. MATLAB实际上不会清除所有变量吗?还是这是记忆的碎片?

will also crash; in order to run it multiple times, I have to restart MATLAB each time. Does MATLAB not actually clear all variables? Or is this a fragmentation of memory thing?

推荐答案

Matlab确实可以隐藏"一些变量和其他设置.我设置了以下快捷方式,以将其恢复为刚刚打开"状态(真正可以吸引您的地方是,清除功能不是全部清除的子集).

Matlab can indeed hold onto some variables and other settings "under the hood". I have the following set up as a short-cut to purge it back to a "just switched on" state (the one that can really catch you out is that clear functions is not a subset of clear all).

restoredefaultpath;
clc;
clear all;
close all;
clear functions;
bdclose('all');
fclose('all');

这篇关于清除后MATLAB是否保留一些变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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