필터 지우기
필터 지우기

Covert Matlab Code to C language

조회 수: 1 (최근 30일)
Rohan  Mehta
Rohan Mehta 2019년 6월 29일
댓글: Sameer Gadekar 2019년 6월 29일
Hello There, I have made an matlab code and I want to covert the given code to C, I am using the inbuilt app to convert the code but facing some problems Can anyone help ?
The relevent documents are attached.
  댓글 수: 2
Sameer Gadekar
Sameer Gadekar 2019년 6월 29일
Code generation does not support variable 'X' growth through indexing. where in your code X is k max1 and q.
k(j+1) = i;
max1(n)=max(mat1(:));
q(t) = find(A == max1(t),1,'first');
This is limitation of the coder.
Please find the solution on the below link
Sameer Gadekar
Sameer Gadekar 2019년 6월 29일
function G = Bioscan(W) %#codegen
W = load('C:\Users\ROHAN\Desktop\C4.csv');
A = W(:,2);
C = find(A<75);
k = [];
max1 = [];
q = [];
A(C) = 0;
i = 1;
j = 0;
n = 1;
t = 1;
k = 0;
max1 = 0;
q = 0;
while i<1000004
while A(i)>75
k = [k i];
i = i+200000;
j = j+1;
if j == n
mat1=A((k(n)-25):(k(n)+30));
max1 = [max1 max(mat1(:))];
n = n+1;
end
if (i - 200000) ~= k(j)
A(i-200000) = 0;
end
if j == 5
break
end
if i > 1000004
r = 1;
V = fprintf('Invalid Data \n');
return
end
end
if j == 5
while t<=5
q = [q find(A == max1(t),1,'first')];
t = t+1;
end
idx = setdiff(1:length(A),q); % indexes which are not in q
A(idx) = 0;
plot(A);
title('Recieved Signal');
xlabel('Samples');
ylabel('Amplitute (In mV)');
return;
end
if (j <= 4 && j >= 1)
i = k(1)+1;
j = 0;
o = 1;
n = 1;
end
i = i+1;
end
end

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by