Unknown exception 0x80000026 Error/Crash with Simulink

Hello, I have created a system object inside a simulink model. Right now it does something like this (nothing so far:P, because I'm stuck on technicalities):
function setupImpl(obj,u)
% Implement tasks that need to be performed only once,
% such as pre-computed constants.
obj.memory = -ones(11, 11);
end
function [Out] = stepImpl(obj,message)
% Implement algorithm. Calculate y as a function of
% input u and discrete states.
i = find(obj.memory(:,1) == message(1));
if(all(i ~= 0)) %find id already in memory
Out = i(1);
else
Out = i(1);
end
end
When it executes it crashes with this error message: Unknown exception 0x80000026 I realized that I have to use the scalar value of i, but when I call it i(1) it won't work. Also i is always supposed to either be empty or return 1 index (there cannot be more than 1 occurrence).
Any ideas?

1 Comment

I made this modification:
function [Out] = stepImpl(obj,message)
i = find(obj.memory(:,1) == message(1),1);
if(isempty(i) ~= 0)
Out = i(1);
else
Out = i(1);
end
end
But still when I try to access i(1) the crash persists.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!