Welcome! Log In Create A New Profile

Advanced

Access violation when saving/loading

Posted by poncelaboratory 
Access violation when saving/loading
October 29, 2020 04:21PM
I am getting an access violation (MATLAB needs to close). The problem seems to be a mex file from the MonkeyLogic daqtoolbox (see error trace).
The error is intermittent. Here is how it happens.
Changes I made:
Click run and a userloop file opens. The first thing the userloop does is open a MATLAB gui which asks the experimentor for some parameters. Prior to displaying the gui loads the last saved parameters (call this the "first load"). The user clicks "done" and the app saves the parameters.
After the experiment, after "behaviorsummary" in the monkeylogic source code, I added a line to run a different function. That function loads the parameters that were saved earlier and moves files (call this the "second load").

When the error happens
The first time I run an experiment it all works. The second time I run an experiment I get the access violation when trying to load a file. The access violation occurs at either the "first load" or the "second load". However it ALWAYS occurs on the second or third time I try to run the whole userloop.

I've attached the crash dump file.

Please help me figure out the source of the crash.
Attachments:
open | download - matlab_crash_dump_17880-2.txt.txt (34 KB)
Re: Access violation when saving/loading
October 29, 2020 05:17PM
I should add that this happens with the latest version of monkeylogic (version 2.2) and version 2.0. These are the only two I tested.
Re: Access violation when saving/loading
October 29, 2020 07:21PM
I don't think the daqtoolbox is the problem here. Use MATLAB's debug tool and find which line of your userloop causes the error. And post your userloop, please. In many cases, this kind of error is related to MATLAB GUI or the graphics driver. Do not invoke MATLAB GUI in the userloop. You can use editable(), if you have parameters to adjust before running experiments. Sometimes switching to the software version of OpenGL or updating the graphics driver helps.

The directory name, NIMHMonkeyLogic2, is different from what the current packages are supposed to create. See your "C:\Users\Ponce lab\AppData\Roaming\MathWorks\MATLAB Add-Ons\" directory and check whether NIMH ML is installed correctly. If there are multiple directories, delete them all and reinstall NIMH ML.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.