MATLAB Answers

I get a memory allocation error when try to save my simulink model. How can i fix it?

77 views (last 30 days)
Behnam Adlkhast
Behnam Adlkhast on 12 Apr 2016
Answered: Mukhtiar Ahmad on 8 Dec 2018
My simulink model was working complitly fine. But suddenly i get this memory allocation error when i try to save my model! and also when i try to build the model i get another error "Undefined function 'sflink2chart' for input arguments of type 'double' " would you please help me about these errors.


Sign in to comment.

Answers (2)

Subin Kuttappan Stellal Mary
Refer this link posted by MathWorks Technical Support team which addresses the 'memory allocation error'


Dusan on 4 Dec 2017
This is (likely, I don't have access to the code) a return on a memory allocation request error. It may not be a problem of lack of physical memory (Unless you have a very old machine, or a lot of scopes, most will have virtual memory sufficient to allocate more than enough). This shouldn't be a problem on modern systems with well written software. Simulation may not run if you run out of disk space, but saving?
I have seen this error caused by invalid Simulink blocks. For instance, I have just seen this error caused when attempting to save a model previously saved in a newer version of Matlab. In this case, only stateflow blocks were problematic (some 2015b models without stateflow blocks can be saved in 2013b) So, it may be that when attempting to allocate the memory for the chart an error was returned, and dropped into a "memory error" catch or finally bucket. Not a great error message when the real problem is version related.
The difficulty is compounded because once saved without the charts, the model appears normal, but I can't add stateflow to it. Thus the problem may be hidden. I have also run into the problem with from time to time with library blocks.
So, in my cases, this was caused by libraries or models saved in more recent versions. By opening them in a newer version (and if required for compatibility reasons, exporting to the older version) the problem can be resolved.
Dusan on 4 Dec 2017
The message "Undefined function 'sflink2chart' for input arguments of type 'double' is also a clue. This function is not defined perhaps because it is in an S function not on the path or poorly defined matlab function. I suspect if you track down this function you will eliminate both errors.

Sign in to comment.

Mukhtiar Ahmad
Mukhtiar Ahmad on 8 Dec 2018
my simulation stop after passing of 0.442 second without sowing any error, what i do?i need help in this regard.


Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by