From 927a1235b9e9459ca314c0ae3c32cb0cd5c0cee9 Mon Sep 17 00:00:00 2001 From: "thomas.mejer.hansen" Date: Mon, 22 Aug 2022 18:50:55 +0200 Subject: [PATCH] memory_get: Get memory on linux/windows --- misc/memory_get.m | 14 ++++++++++++++ nscore.m | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 misc/memory_get.m diff --git a/misc/memory_get.m b/misc/memory_get.m new file mode 100644 index 0000000..0d1bcc9 --- /dev/null +++ b/misc/memory_get.m @@ -0,0 +1,14 @@ +function [mem_total,mem_used,mem_available]=memory_get(); +mem_total=[]; +mem_used=[]; +mem_available=[]; +if isunix + [r,w] = unix('free | grep Mem'); + ws=split(w); + mem_total=str2num(ws{2})/1e+6; + mem_used=str2num(ws{3})/1e+6; + mem_available=str2num(ws{4})/1e+6; +else iswin==1 + [USERVIEW, SYSTEMVIEW] = memory; + mem_total=USERVIEW.MaxPossibleArrayBytes/1024/1E+6; +end \ No newline at end of file diff --git a/nscore.m b/nscore.m index 1a341ef..0128b92 100644 --- a/nscore.m +++ b/nscore.m @@ -189,7 +189,7 @@ xlabel('X'); ylabel('CPDF') title('ORIG CDF') - legend('ORG+Head+Tail','ORIGINAL',4) + legend('ORG+Head+Tail','ORIGINAL') end