Can anyone tell me to convert following code into C or arduino code?

Code in matlab is:

clc;

clear all;

close all;

load EEG1_1c31;% loading data

Ts=2;% sampling period

Fs=500;%sampling frequency

[N,nu]=size(data);%obtain size of data

t=(1:N)*Ts;%generates time vector

Fs = 500; % Sampling Frequency

Fstop1 = 7.5; % First Stopband Frequency

Fpass1 = 8; % First Passband Frequency

Fpass2 = 12; % Second Passband Frequency

Fstop2 = 12.5; % Second Stopband Frequency

Dstop1 = 0.0001; % First Stopband Attenuation

Dpass = 0.057501127785; % Passband Ripple

Dstop2 = 0.0001; % Second Stopband Attenuation

dens = 20; % Density Factor

% Calculate the order from the parameters using FIRPMORD.

[N, Fo, Ao, W] = firpmord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 1 0], [Dstop1 Dpass Dstop2]);

% Calculate the coefficients using the FIRPM function.

b3 = firpm(N, Fo, Ao, W, {dens});

Hd3 = dfilt.dffir(b3);

x3=filter(Hd3,data);

%FREQUENCY SPECTRUM OF ALPHA BAND

L=10;

Fs=500;

NFFT = 2^nextpow2(L); % Next power of 2 from length of x3

Y3 = fft(x3,NFFT)/L;

f = Fs/2*linspace(0,1,NFFT/2);

%BETA BAND PASS FILTER (12-30)

Fs = 500; % Sampling Frequency

Fstop1 = 11.5; % First Stopband Frequency

Fpass1 = 12; % First Passband Frequency

Fpass2 = 30; % Second Passband Frequency

Fstop2 = 30.5; % Second Stopband Frequency

Dstop1 = 0.0001; % First Stopband Attenuation

Dpass = 0.057501127785; % Passband Ripple

Dstop2 = 0.0001; % Second Stopband Attenuation

dens = 20; % Density Factor

% Calculate the order from the parameters using FIRPMORD.

[N, Fo, Ao, W] = firpmord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 1 0], [Dstop1 Dpass Dstop2]);

% Calculate the coefficients using the FIRPM function

b4 = firpm(N, Fo, Ao, W, {dens});

Hd4 = dfilt.dffir(b4);

x4=filter(Hd4,data);

x=x3./x4;

b= x3(:,3);

c= x3(:,4);

d= x4(:,3);

e= x4(:,4);

f=(b./c)-(d./e);

for j= 2:32

sum=0;
for i= 1:16
sum = sum + x(j,i);
end
Mean_arousal = sum/16;
Mean_valence = f(j,:);
if Mean_arousal>0
if Mean_valence>0
a = 'Happy';
end
end
if Mean_arousal>0
if Mean_valence<0
a = 'stressed';
end
end
if Mean_arousal<0
if Mean_valence<0
a = 'Depressed';
end
end
if Mean_arousal<0
if Mean_valence>0
a = 'Sad';
end
end
end

clc;
clear all;
close all;
%load EEG1_1c31;% loading data
data=[0.0537000000000000,0.0336000000000000,0.0470000000000000,0.0671000000000000,0.0403000000000000,0.0739000000000000,0.0403000000000000,0.0201000000000000];
Ts=2;% sampling period
Fs=500;%sampling frequency
[N,nu]=size(data);%obtain size of data
t=(1:N)*Ts;%generates time vector

Fs = 500; % Sampling Frequency
Fstop1 = 7.5; % First Stopband Frequency
Fpass1 = 8; % First Passband Frequency
Fpass2 = 12; % Second Passband Frequency
Fstop2 = 12.5; % Second Stopband Frequency
Dstop1 = 0.0001; % First Stopband Attenuation
Dpass = 0.057501127785; % Passband Ripple
Dstop2 = 0.0001; % Second Stopband Attenuation
dens = 20; % Density Factor

% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 1 0], [Dstop1 Dpass Dstop2]);
% Calculate the coefficients using the FIRPM function.
b3 = firpm(N, Fo, Ao, W, {dens});
Hd3 = dfilt.dffir(b3);
x3=filter(Hd3,data);

%BETA BAND PASS FILTER (12-30)

Fs = 500; % Sampling Frequency

Fstop1 = 11.5; % First Stopband Frequency
Fpass1 = 12; % First Passband Frequency
Fpass2 = 30; % Second Passband Frequency
Fstop2 = 30.5; % Second Stopband Frequency
Dstop1 = 0.0001; % First Stopband Attenuation
Dpass = 0.057501127785; % Passband Ripple
Dstop2 = 0.0001; % Second Stopband Attenuation
dens = 20; % Density Factor

% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 1 0], [Dstop1 Dpass Dstop2]);

% Calculate the coefficients using the FIRPM function
b4 = firpm(N, Fo, Ao, W, {dens});
Hd4 = dfilt.dffir(b4);
x4=filter(Hd4,data);

x=x3./x4;
b= x3(:,3);
c= x3(:,4);
d= x4(:,3);
e= x4(:,4);
f=(b./c)-(d./e);
sum=0;
for i= 1:16
sum = sum + x(1,i);
end

Mean_arousal = sum/16;
Mean_valence = f(1,:);
if Mean_arousal>0
if Mean_valence>0
a = 'Happy';
end
end
if Mean_arousal>0
if Mean_valence<0
a = 'stressed';
end
end
if Mean_arousal<0
if Mean_valence<0
a = 'Depressed';
end
end
if Mean_arousal<0
if Mean_valence>0
a = 'Sad';
end
end

what language is that?

@RK725, do not cross-post. Threads merged.

Grr.
The code is almost entirely "setup" for the MATLAB firpmord(), firpm(), dfilt.dffir(), and filter() functions (signal processing of some kind?)
These don't exist in C or on Arduino, unless you're lucky enough to find some sort of "matlab-compatibility" library.
It may be that they are impossible to run on the very resource-limited microcontrollers of the Arduino-world.

If you can run the Arduino while tethered to a laptop, then just have it send the values to the PC for processing in Matlab.

To convert, you would either have to find existing Arduino libraries that implement filter(), fft() and the other functions or you will have to write your own libraries to do it. This is a very large task.