I have generated a C code using MATLAB coder which takes 2000 data points and then tries to find out the peaks in that data. You can see my main.c code bellow:
#include <stdio.h>
#include <stdlib.h>
#include "MYALGORITHM.h"
double PPG[2000]={0};
double a;
double heart_rate,summation;
int main()
{
MYALGORITHM(PPG,1,1,&heart_rate,&summation);
printf("%f",heart_rate);
}
I am not able to run this main code the error is as follows:
||=== Build: Debug in Heart_rate_Algorithm_test (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\Syed Mir Hamza\Desktop\Heart_rate_Algorithm_test\main.c|12|undefined reference to `MYALGORITHM'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
can someone please help me out in this the. I have also generated a separate Addition function and it worked fine. Right now I added both the summation and peak detection algorithm in the same MATLAB function which is as follows:
function [HR,sum] = MYALGORITHM(PPG,k,l)
a = PPG(1:2000,:);
PKS = findpeaks(a,'MinPeakDistance',200);
HR = length(PKS)*7.25;
sum = k + l;
end
I would be really thankful if someone can help me out. Thanks in advance.