20 [
varargout[1:nargout]] = builtin(
" memory ");
25 cmd =
" cat /proc/meminfo | grep MemFree ";
26 [s, msg] = system(cmd);
28 fprintf(2,
" Failed to run system command: %s: %s\n ", cmd, msg);
30 v = str2double(strtrim(msg(9:end-3)))*1024;
32 userview.MaxPossibleArrayBytes= v;
33 userview.MemAvailableAllArrays= v;
36 cmd =
" ps -e | grep MATLAB ";
37 [s, msg] = system(cmd);
40 fprintf(2,
" Failed to run system command '%s': %s\n ", cmd, msg);
42 pos = strfind(msg,
" ");
43 pid = str2double(msg(1:pos(1)-1));
45 cmd = sprintf(
" cat /proc/%d/status | grep VmSize ",pid);
46 [s, msg] = system(cmd);
48 fprintf(2,
" Failed to run system command '%s': %s\n ", cmd, msg);
50 v = str2double(strtrim(msg(8:end-3)))*1024;
53 userview.MemUsedMATLAB= v;
56 cmd =
" cat /proc/meminfo | grep MemTotal ";
57 [s, msg] = system(cmd);
59 fprintf(2,
" Failed to run system command '%s': %s\n ", cmd, msg);
61 userview.TotalSystemMemory= str2double(strtrim(msg(10:end-3)))*1024;
64 error(
" not implemented for mac yet. ");
67 varargout[1] = userview;
function varargout = memory()
memory: Imitates the memory function for all platforms.
A variable number of output arguments.