필터 지우기
필터 지우기

Simulink Coder -- Code generation Error for circshift command

조회 수: 3 (최근 30일)
Sameer Gadekar
Sameer Gadekar 2019년 8월 28일
편집: Hari Krishna Ravuri 2020년 1월 6일
Hello ,
In Simulink Model I have used circshift command . Code generation is successful but I am getting wrong generated code.
Please help me out.
function Value = fcn(u, Limit)
%#codegen
persistent queue
y = length(find(abs(u)>Limit));
% Set the parameters of our queue
n = 1; % length of each vector in queue
max_length = 6;
% Initialize a queue of length of n*max_length vectors
if isempty(queue)
queue = zeros(n, max_length);
end
queue_length = 0;
queue = circshift(queue, 1, 2); % Move each column to the right
queue(:,1) = y; % Add new vector to queue
queue_length = min(max_length, queue_length + 1);
Value = sum(queue);
  댓글 수: 1
Hari Krishna Ravuri
Hari Krishna Ravuri 2020년 1월 6일
편집: Hari Krishna Ravuri 2020년 1월 6일
This looks fine for me.What was the given input? What is the expected output of the Simulink model?What output are you getting from generated code?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by