Doubt about minimum values

I have a vector A (any division) and a vector B (divided from 0.1 in 0.1). I would like to store some values of B that are in vector A but, since they have different divisions, I had cut at a given interval pp = 0.15, using the loop (below), and it worked. Now I would like to store the value obtained at C1 closer to the value of B = 1.3 and C = [1.4.1.5], keeping C = 1.4), how do I do this?
for ii=1:length(A(1,:))
C=find(A(ii)-pp<=B&B<=A(ii)+pp);
C1=B(C);
end
Thank you for your help.

5 Kommentare

madhan ravi
madhan ravi am 21 Aug. 2018
To store the value of C1 inside each iteration , you have to use the iteration as the index i.e.,
C(ii)=find(A(ii)-pp<=B&B<=A(ii)+pp);
C1(ii)=B(C(ii))
jonas
jonas am 21 Aug. 2018
You may be interested in ismembertol(A,B,tol)
Image Analyst
Image Analyst am 21 Aug. 2018
I have no idea what "(divided from 0.1 in 0.1)" means - please explain more clearly.
Please attach A and B in a .mat file. And give a small example, like with 10 elements or something.
Thaís Fernandes
Thaís Fernandes am 21 Aug. 2018
Hello.
Explaining to me:
These vectors are of type A = [1,1,4,1,2,5,5,2] and B = [1,1,1,1,2,1,3,1,4,1.5].
Image Analyst
Image Analyst am 21 Aug. 2018
You say "I would like to store some values of B that are in vector A". Where would you like to store them? In C? In C1? Some other variable?
You say "I had cut at a given interval pp = 0.15". What do you mean by "cut"? Does that mean threshold? What do you mean by interval? An interval has two values, a low and a high, not a single value like 0.15.
You say "I would like to store the value obtained at C1" What value is that? Where is it - what index of C1 and how was C1 computed before you found an index in it.
What values, for the A and B you gave, should C and C1 have, and how are they related to 0.15?

Antworten (0)

Diese Frage ist geschlossen.

Gefragt:

am 21 Aug. 2018

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by