Reputation: 2106
How can I get the memory usage for execution of an instruction in matlab? I look like for something like the tic
toc
function.
The problem is that the method must work on windows and on linux.
I try to use this function that use the whos
command but it doesn't work, it return a wrong value.
I would get the memory usage of this command
solution = matrix \ knownTerms;
where solution
and knownTerms
are two vector.
How can I get the memory used by this operation?
Upvotes: 0
Views: 1447
Reputation: 23858
If your code is inside a function, you can use the memory mode of the Matlab Profiler to get rough function-level memory usage. Run profile on -memory
, run your code, and then run profile report
. If you need to get the memory usage of just that one statement, wrap it in a local function.
Upvotes: 2