Simulink Matlab Function - Using Cell Problem

2 Ansichten (letzte 30 Tage)
delil codes
delil codes am 26 Apr. 2021
Kommentiert: delil codes am 1 Mai 2021
I coded all functions in m file, its works clearly in normal file, But when I want to use Simulink there is a problem like:
Unable to determine that every element of 'l_manLinkMatSkewSymm{1}{:}' is assigned before this line.
I did not understand the problem. The problem is on line 4 from the end.
l_negativeLinkMatSkewSymm{k}{i,i}...
= -l_manLinkMatSkewSymm{k}{i,i};
Unable to determine that every element of 'l_manLinkMatSkewSymm{1}{:}' is assigned before this line. More informationFunction 'MATLAB Function1' (#63.1776.1804), line 77, column 16: "l_manLinkMatSkewSymm{k}{i,i}" Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Errors occurred during parsing of MATLAB function 'untitled/MATLAB Function1'
Component: MATLAB Function | Category: Coder error
Errors occurred during parsing of MATLAB function 'untitled/MATLAB Function1'
Component: Simulink | Category: Model error
% % % % % % % Matlab Function Codes Built in Simulink, Lauches here
function dotVarsLinkVars ...
= funFunc(Vc_loadVelVect)
skewSymm =@ (x)[0 -x(3) x(2); x(3) 0 -x(1); -x(2) x(1) 0];
p_maniNum = 2;
dof = cell(p_maniNum,1);
dof{1} = 7;
dof{2} = 5;
PHI_manPropMat = cell(p_maniNum,1);
for i = 1:p_maniNum
PHI_manPropMat{i} = cell(dof{i},dof{i});
end
for k = 1:p_maniNum
for i = 1:dof{k}
for j =1:dof{k}
PHI_manPropMat{k}{i,j} = zeros([6 6]);
end
end
end
% l_linkage Information Matrix
l_manLinkVect = cell(p_maniNum,1);
for i = 1:p_maniNum
l_manLinkVect{i} = cell(dof{i},1);
end
l_manLinkVect{1}{1,1} = [-4; 1; 0];
l_manLinkVect{1}{2,1} = [1; 0; 0];
l_manLinkVect{1}{3,1} = [0; 1; 0];
l_manLinkVect{1}{4,1} = [1; 0; 0];
l_manLinkVect{1}{5,1} = [1; 0; 0];
l_manLinkVect{1}{6,1} = [0; -1; 0];
l_manLinkVect{1}{7,1} = [1; 0; 0];
l_manLinkVect{2}{1,1} = [3.5; 2; 0];
l_manLinkVect{2}{2,1} = [-1; 0; 0];
l_manLinkVect{2}{3,1} = [-1; 0; 0];
l_manLinkVect{2}{4,1} = [0; -1; 0];
l_manLinkVect{2}{5,1} = [-1; 0; 0];
l_manLinkMatSkewSymm = cell(p_maniNum,1);
l_negativeLinkMatSkewSymm = cell(p_maniNum,1);
for k = 1:p_maniNum
l_manLinkMatSkewSymm{k} = cell(dof{k},dof{k});
l_negativeLinkMatSkewSymm{k} = cell(dof{k},dof{k});
for i =1:p_maniNum
l_manLinkMatSkewSymm{k}{i,i}...
= skewSymm(l_manLinkVect{k}{i,1});
l_negativeLinkMatSkewSymm{k}{i,i}...
= -l_manLinkMatSkewSymm{k}{i,i};
end
end
dotVarsLinkVars = l_manLinkMatSkewSymm{2}{1,1};
When I remove that line that have problem on it, system works fine.
  1 Kommentar
delil codes
delil codes am 1 Mai 2021
There is problem with; {i,i}
l_negativeLinkMatSkewSymm{k}{i,i}...
= -l_manLinkMatSkewSymm{k}{i,i};
there is no;
l_manLinkMatSkewSymm{k}{2,2}
I did not try it but. I think this is the problem.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Schedule Model Components finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by