From: Juliette Salexa on 9 Aug 2010 15:48 Hi everyone, I have a memory-demanding function (call it memoryDemanding.m), which works perfectly fine when it is called as a function. I basically execute the command: a=memoryDemanding(b,c); and it works. However, if I go into memoryDemanding.m, and comment the lines that make it a function rather than a script (ie, comment the line that says 'funciton' and the corresponding line that says 'end') and I assign the input variables b and c to be the exact same as they were when I called this script as a function, and I don't change ANYTHING else, and I execute this script by pressing F5, I get: ??? Error using ==> zeros Maximum variable size allowed by the program is exceeded. ============= How is it that the exact same function runs out of memory when being executed as a script rather than as a function ? The memory profile of my computer was the exact same, and the script is supposed to do the exact same as the function.
From: Andy on 9 Aug 2010 16:03 "Juliette Salexa" <juliette.physicist(a)gmail.com> wrote in message <i3pm1l$haj$1(a)fred.mathworks.com>... > Hi everyone, > > I have a memory-demanding function (call it memoryDemanding.m), which works perfectly fine when it is called as a function. I basically execute the command: > a=memoryDemanding(b,c); > > and it works. > > However, if I go into memoryDemanding.m, > and comment the lines that make it a function rather than a script > (ie, comment the line that says 'funciton' and the corresponding line that says 'end') > > and I assign the input variables b and c to be the exact same as they were when I called this script as a function, and I don't change ANYTHING else, and I execute this script by pressing F5, > > I get: > > ??? Error using ==> zeros > Maximum variable size allowed by the program is > exceeded. > > ============= > How is it that the exact same function runs out of memory when being executed as a script rather than as a function ? The memory profile of my computer was the exact same, and the script is supposed to do the exact same as the function. When it's run as a script, it uses the base workspace. It's possible (although I'm not certain) that there is a maximum amount of memory allocated to each individual workspace. Do you have anything else in the workspace when you try this?
From: us on 9 Aug 2010 17:20 "Juliette Salexa" <juliette.physicist(a)gmail.com> wrote in message <i3pm1l$haj$1(a)fred.mathworks.com>... > Hi everyone, > > I have a memory-demanding function (call it memoryDemanding.m), which works perfectly fine when it is called as a function. I basically execute the command: > a=memoryDemanding(b,c); > > and it works. > > However, if I go into memoryDemanding.m, > and comment the lines that make it a function rather than a script > (ie, comment the line that says 'funciton' and the corresponding line that says 'end') > > and I assign the input variables b and c to be the exact same as they were when I called this script as a function, and I don't change ANYTHING else, and I execute this script by pressing F5, > > I get: > > ??? Error using ==> zeros > Maximum variable size allowed by the program is > exceeded. > > ============= > How is it that the exact same function runs out of memory when being executed as a script rather than as a function ? The memory profile of my computer was the exact same, and the script is supposed to do the exact same as the function. carefully look at the error message, again: it does NOT say zeros(10000); %{ ??? Out of memory. Type HELP MEMORY for your options. %} rather, it says zeros(1000000000) %{ ??? Error using ==> zeros Maximum variable size allowed by the program is exceeded. %} which if different, of course... see help computer; % and [a,b,c]=computer; hence, something else in your workspace is interfering with your script... create a break point before the offending line, then look at the variable that defines the ZEROS... us
From: Jan Simon on 9 Aug 2010 18:00 Dear Juliette, > and I assign the input variables b and c to be the exact same as they were when I called this script as a function, and I don't change ANYTHING else, and I execute this script by pressing F5, > > I get: > > ??? Error using ==> zeros > Maximum variable size allowed by the program is > exceeded. There is no memory limit for a certain workspace. If you don't change "ANYTHING" else, this is mysterious. Are you sure, that there is no other difference? A private subfunction? A Matlab function shadowed by a variable defined in the base workspace? We cannot find it, but you and your debugger. Good luck, Jan
|
Pages: 1 Prev: remove a specific frequency from emg signal Next: remove a specific frequency from emg signal |