need help to write a code please

Kindly, i want to write a code for read analog signal 10 times and put these reading in a matrix as

for (int i=0;i<10;i++) {
    a[i]=readRead(A0);
}

then i compare the elements of matrix if they belong to another matrix contain 50 elements as
int b[50] = { 512,519,520,600,...........................,400};

i do not want to make a loop to compare 50 times cause it will take a long time...i want a code to check with minimum time

Tell us what you want to do, not how you think you should do it.

Sorry, but brute force is sometimes the only way to go.

However, I think you are going to have problems with this just because of the noise inherent in reading the analog input, I don't think a check for exact equality will work very well.

Are you trying to match a pattern, or single values?

A binary search will cut the time a lot, as well as hashing.

Tell us what you want to do, not how you think you should do it

i have 4 analog signal patterns i want to check if the reads belongs to which pattern...so that i will make a database for each pattern then check if the new signal belong to the pattern with acceptable error rate

the noise inherent in reading the analog input

good point

I don't think a check for exact equality will work very well

it must have some error rate

Use a hash or binary search to see if the first element is in the pattern array. Then check each one in turn, as soon as it fails to find a match quit the search.

Remember, the arduino does not have much memory for a "database".

Use a hash or binary search to see if the first element is in the pattern array. Then check each one in turn, as soon as it fails to find a match quit the search.

good idea

Remember, the arduino does not have much memory for a "database".

i will take it in my account..thank you

-----------------------but i want to check all the readings at the same time please help

Define "same time".

To the Arduino?

To the human eye?

To a Physicist?

Define "same time".

To the Arduino?

To the human eye?

To a Physicist?

??????????????????

Is there something wrong with your question-mark key?

dany151:

Define "same time".

To the Arduino?

To the human eye?

To a Physicist?

??????????????????

"same time" is subjective. It sounds like you want to do this process with respect to the Arduino. Unfortunately, the Arduino doesn't have a "compare array of values to withing a specific threshold" instruction.

dany151:

Define "same time".

To the Arduino?

To the human eye?

To a Physicist?

??????????????????

Time scales are relative...
To the Arduino, the "same time" is on the order of microseconds.
To the human eye, the "same time" is on the order of 100's of milliseconds.
To a Physicists I work with, the "same time" is on the order of picoseconds (or smaller).
To a Geologist, the "same time" is on the order of hundreds of years (or larger)...

Unfortunately, the Arduino doesn't have a "compare array of values to withing a specific threshold" instruction

i think it need a statistical operation to do like this things

Time scales are relative...
To the Arduino, the "same time" is on the order of microseconds.
To the human eye, the "same time" is on the order of 100's of milliseconds.

for me i process human eye signal with arduino...

i think it need a statistical operation to do like this things

Like what things? Can you try that sentence again?

Like what things? Can you try that sentence again?

like find the Mean absolute error or Mean squared error

It might save a bit of time if you just pasted your assignment here.

in the figure below you will see that i have 2 arrays and 4 analog reads ...

i want to know the position of the analog signal in which part (1 or 2 or 3 or4) as below

it is like windowing

How big is the range of values for comparison?
How many arrays are you using (4)?

Is there any reason why these elements are not ordered?

int b[50] = { 512,519,520,600,...........................,400};