From: Faraz Afzal on
"fiza khalid" <princess.2050(a)hotmail.com> wrote in message <i0pqp7$m89$1(a)fred.mathworks.com>...
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i02uuj$ggv$1(a)fred.mathworks.com>...
> > "fiza khalid" <princess.2050(a)hotmail.com> wrote in message <i02te6$8bm$1(a)fred.mathworks.com>...
> > > i want to calculate the memory used by my function which i am try to run in matlab
> > > can anyone help me to try this.which function is used for memory display please tell me if someone knows about it.
> > > thanx in advance.
> > ===========
> >
> > Your problem is not fully formulated because the "memory used by a function" is not a well-defined thing.
> >
> > In MATLAB, a variable in a function's workspace can share memory with other variables that reside either in the same workspace or outside of it. So, how would you define which blocks of memory that a given function owns?
> >>i want to know how much processor memory is being used while i am running my program not the single variable memory but the as a whole memory taken by my program how can i do that.help me.


Dear Fiza,

I am of the view that you still need to elaborate your question more. Let me go through the series of questions you asked:

>>i want to know how much processor memory is being used while i am running my program
Processor Memory , ?? Is that CPU Cache memory being utilised OR it is PIM you are interested in?? IF THIS is what you asked then MATLAB does not make use of these memories. !!! Secodly as it sounds to me you are asking abt the variable space , variable memory tehn within your function let your variables be published to cmd, and you will check all the stuff with whos command. This step is necessary as I know MATLAB has function variable space that is not shared with command variables workspace, and fucntion variable space is flushed right after the execution is completed.

Lastly is that you are interested in CPU resources being used when you run your program ? Answer is they are same as used by MATLAB as a whole + variable spaces being called dynamically.

Very lastly if you need to know the whole resources memory etc etc being used by your function only you will need to make a standalone application and then run it to find out.
It would have been better if you explained your problem a little more.

I hope it helps,
Regards,
Muhammad Faraz
From: ImageAnalyst on
Sorry if I'm asking something really obvious that you've already
tried, but (since you didn't mention it) did you try the memory
command?

myMemory = memory % myMemory will be a structure.

myMemory =
MaxPossibleArrayBytes: 947585024
MemAvailableAllArrays: 1.4247e+009
MemUsedMATLAB: 451756032
From: us on
"fiza khalid" <princess.2050(a)hotmail.com> wrote in message <i02te6$8bm$1(a)fred.mathworks.com>...
> i want to calculate the memory used by my function which i am try to run in matlab
> can anyone help me to try this.which function is used for memory display please tell me if someone knows about it.
> thanx in advance.

a hint:
- PROFILE shows you all you want (and more) if you unleash some if its
undoc strength...

% edit your STARTUP.M
% add these commands
setpref('profiler','showJitLines',1);
profile -memory on;
profile off;
% now, PROFILE your function and look at all the information you get...

us
From: fiza khalid on
"Faraz Afzal" <farazafzal(a)gmail.com> wrote in message <i0ps84$pfu$1(a)fred.mathworks.com>...
> "fiza khalid" <princess.2050(a)hotmail.com> wrote in message <i0pqp7$m89$1(a)fred.mathworks.com>...
> > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i02uuj$ggv$1(a)fred.mathworks.com>...
> > > "fiza khalid" <princess.2050(a)hotmail.com> wrote in message <i02te6$8bm$1(a)fred.mathworks.com>...
> > > > i want to calculate the memory used by my function which i am try to run in matlab
> > > > can anyone help me to try this.which function is used for memory display please tell me if someone knows about it.
> > > > thanx in advance.
> > > ===========
> > >
> > > Your problem is not fully formulated because the "memory used by a function" is not a well-defined thing.
> > >
> > > In MATLAB, a variable in a function's workspace can share memory with other variables that reside either in the same workspace or outside of it. So, how would you define which blocks of memory that a given function owns?
> > >>i want to know how much processor memory is being used while i am running my program not the single variable memory but the as a whole memory taken by my program how can i do that.help me.
>
>
> Dear Fiza,
>
> I am of the view that you still need to elaborate your question more. Let me go through the series of questions you asked:
>
> >>i want to know how much processor memory is being used while i am running my program
> Processor Memory , ?? Is that CPU Cache memory being utilised OR it is PIM you are interested in?? IF THIS is what you asked then MATLAB does not make use of these memories. !!! Secodly as it sounds to me you are asking abt the variable space , variable memory tehn within your function let your variables be published to cmd, and you will check all the stuff with whos command. This step is necessary as I know MATLAB has function variable space that is not shared with command variables workspace, and fucntion variable space is flushed right after the execution is completed.
>
> Lastly is that you are interested in CPU resources being used when you run your program ? Answer is they are same as used by MATLAB as a whole + variable spaces being called dynamically.
>
> Very lastly if you need to know the whole resources memory etc etc being used by your function only you will need to make a standalone application and then run it to find out.
> It would have been better if you explained your problem a little more.
>
> I hope it helps,
> Regards,
> Muhammad Faraz
>>Thnx for your response
>>actually i am doing a comparison of two algorithms so that's why i need to know the cpu resources used by each algo in matlab i am checking them with respect to time and memry.so i have done with time but confused while doing with memory as in matlab i dont know how to do that without that WHOS commant as it gives only varaible space not whole function memory.i hope ou will understand my problem and help me.
thnx.