Why does the code shows match values and mismatch values??

one_c=0;
tem_h=-100;
tem_L=100;
high_p=0;
low_pr=0;
o_pr=0;
for p = 1:no_ofbits
for m = 1:process_g
pin=m+(p-1)*process_g;
o_p=o_p+quick(pin);
if strong(pin)==1
one_c=one_c+1;
if v(pin)>=tem_h
tem_h=v(pin);
high_p=pin;%pointer is for diagnostic purposes
end
if v(pin)<=tem_L
tem_L=v(pin);
low_p=pin;%printer is for diagnostic purposes
end
end
end
end
am = temp_h + temp_L;
am = (ad/2);
a1 = (am/5);
b1=t(win(1));
verify(1)=a1;
verify(2)=b1;
verify(3)=o_p;
I am trying to run this code. everytime I run the code matrix verify shows (1), (2) columns matched and (3) which is what I want as 0. But when I run the same code everytime during 8th or 11th time it shows a mismatch between (1), (2). I have run this code many times. but still it shows correct result, but during 7times and 8th times it fails. I am trying it extremely hard to understand why is it showing a mismatch and then again match after that.
Can someone please help me in this? I am not able to list out the reason why is it behaving correct in some runs and changes output after 8th or 9th run. Kindly help

4 Comments

Output of the above code
verify =
2.2416 2.2416 0
verify =
0.9565 0.9565 0
verify =
1.5510 1.5510 0
verify =
2.5810 2.5810 0
verify =
3.8400 3.8400 0
verify =
1.1209 1.1209 128.0000
We are missing inputs and/or functions.
With the mention of "pin" I wonder if this is talking to a hardware device?
no_ofbits = 20;
p_gain = 32;
pin=m+(p-1)*p_gain;
Undefined function or variable 'process_g'.
Undefined function or variable 'o_p'.
Undefined function 'quick' for input arguments of type 'double'.
Undefined function or variable 'strong'.
Undefined function or variable 'v'.

Sign in to comment.

Answers (0)

Categories

Asked:

on 10 Jun 2019

Commented:

on 11 Jun 2019

Community Treasure Hunt

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

Start Hunting!