help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extracting the closest possible value having the same indices


From: GK19
Subject: Extracting the closest possible value having the same indices
Date: Thu, 28 May 2020 06:31:38 -0500 (CDT)

t1 ยด= 2.3
t2 = 5.6

%its is a 2*7*1*10*10*15*8 matrix
p = period_arr(1,:,:,:,:,:,:); % this is of the form p =
period_arr(p1,p2,p3,p4,p5,p6,p7);
n = period_arr(2,:,:,:,:,:,:); % this is of the form n =
period_arr(n1,n2,n3,n4,n5,n6,n7);

dist_p = abs(p - t1);
[min_dist_p, idx_p] = min(dist_p(:));

dist_n = abs(n - t2);
[min_dist_n, idx_n] = min(dist_n(:));

c_tp = p(idx_p);
c_tn = n(idx_n);

So based on the minimum distance i get the closest value, and it is working
fine.

But, I have a problem here I have to get only the closest value where the
indices p4 = n4  and p5 = n5. It should regulate the same value for both p
and n. 

How do i do that? please help me out. I am stuck in this problem from 2 days

For example
I can have
2.6 = period_arr (1,:,:, a, b,:, :)
7.8 = period_arr (2,:,:, a, b,:, :)



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]