Covert Matlab Code to C language
3 views (last 30 days)
Show older comments
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 Comments
Sameer Gadekar
on 29 Jun 2019
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
on 29 Jun 2019
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
Answers (0)
See Also
Categories
Find more on Pulsed Waveforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!