关于Linux下面运行Matlab有关memory命令不存在的问题

来源:互联网 发布:淘宝买的东西在哪好评 编辑:程序博客网 时间:2024/05/18 19:44
今天,在Linux下面运行matlab的一个程序,需要用到当前系统的内存使用情况。使用memory时,出现了问题:
>> memory 
??? Error using ==> memory 
Function MEMORY is not available on this platform.
后来help了一下memory才发现,原来这个指令现在只适合在windows下使用,具体使用见matlab里面的相关文档。后来就各种搜,终于找到答案了。可以采用如下命令:
[r,w] = unix('free | grep Mem'); 
stats = str2double(regexp(w, '[0-9]*', 'match'));
memsize = stats(1)/1e6;单位为Gbytes
freemem = (stats(3)+stats(end))/1e6 ;单位为Gbytes
由于我只需要用到这些,具体的内容可以参考如下链接:
http://stackoverflow.com/questions/12350598/how-to-access-memory-information-in-matlab-on-unix-equivalent-of-user-view-max。
0 0
原创粉丝点击