如何解决MATLAB中的内存不足错误? [英] How can I resolve out of memory error in MATLAB?

查看:1496
本文介绍了如何解决MATLAB中的内存不足错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算2个大小为(10304,1034)的协方差矩阵,而matlab创建第一个协方差矩阵,但是当它运行第二个命令时,会发生此错误:

I want to calculate 2 covariance matrices with size (10304,1034) and matlab creates the first one but when it runs the second command, this error occurs:

>> j=ones(10000,10000);
>> jj=ones(10000,10000);
??? Out of memory. Type HELP MEMORY for your options.

我的笔记本电脑的RAM为2GB,但仍有1GB可用空间.我正在使用Windows 7和32位MATLAB 2009b.

My laptop's RAM is 2GB, but it still has 1 GB free. I am using Windows 7 and 32-bit MATLAB 2009b.

如何解决此错误?

推荐答案

一个10k x 10k的双精度数组使用1e8 * 8字节,相当于800MB. MATLAB需要这些800MB是连续的.您的1GB可用内存极有可能是零散的,因此MATLAB无法将新阵列装入RAM.

A 10k-by-10k array of doubles uses 1e8*8 bytes, which corresponds to 800MB. MATLAB needs these 800MB to be contiguous. Most likely, your 1GB free memory is a little fragmented, so MATLAB cannot fit the new array into RAM.

使用命令内存查找MATLAB在给定时刻可以处理的最大变量大小.

Use the command MEMORY to find out the maximum variable size that MATLAB can handle at a given moment.

这篇关于如何解决MATLAB中的内存不足错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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