Skip to content

Instantly share code, notes, and snippets.

@wouterpotters
Created February 10, 2015 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wouterpotters/c9b4c1cf07acc3bcae4f to your computer and use it in GitHub Desktop.
Save wouterpotters/c9b4c1cf07acc3bcae4f to your computer and use it in GitHub Desktop.
Matlab memory function for Mac OS X
if ismac % if computer is a mac.
[~,txt] = system('sysctl -a | grep hw.memsize | awk ''{print $2}'''); % get physical system memory
memory_avail_in_gb = (eval(txt)/1024^3); % convert from byte to Gb.
fprintf(['Available memory: ' num2str(memory_avail_in_gb) ' Gb']) % display amount of memory available
else % on pc's
memory % use builtin memory function
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment