I defined this simple class in Simulink, and I want to create and share a 5x5 matrix of this class.
classdef evidential_grid
properties
Occ
Libr
Incert
Conf
end
methods
function obj = evidential_grid() % Grid Constructor
obj.Occ = 0;
obj.Libr = 1;
obj.Incert = 0;
obj.Conf = 0;
end
end
end
In matlab, this code works to create a matrix of 5x5
myGrid(5,5) = evidential_grid();
As we know. Simulink does not accept dynamic allocation of variables, so I should initialize it first.
For that, I created
function fcn()
%#codegen
global MySharedVariable;
coder.extrinsic('evidential_grid');
MySharedVariable(5,5) = evidential_grid();
- a matlab function in simulink
- a block of Data Store Memory to share a variable of "evidential_grid" type
But when I executed my simulink model I got these errors!
- Global declaration not resolved to a Data Store Memory block registered via the Ports and Data Manager.
- Errors occurred during parsing of MATLAB function
Please find me a solution, Thank you.