help-octave
[Top][All Lists]
Advanced

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

Re: Getting the closest value having the same index value


From: Francesco Potortì
Subject: Re: Getting the closest value having the same index value
Date: Fri, 29 May 2020 22:10:10 +0200

>t1 ´ = 2.3

what is "´ =" ?

>t2 = 5.6
>p = zeros (length (ring_vec), length (opcon_vec), length (rccorner_vec), .... 
>)% writing all the length of all the vec files
>n = zeros (length (ring_vec), length (opcon_vec), length (rccorner_vec), .... 
>)%
>for ioc = 1: 1: length (ring_vec)
>for ipc = 1: 1: length (opcon_vec)
>for irc = 1: 1: length (rccorner_vec)
>for inw = 1: 1: length (vnw_vec)       
>for ipw = 1: 1: length (vpw_vec)
>for ivdp = 1: 1: length (vdd_vec)
>for itp = 1: 1: length (temp_vec)
>% its is a 2 * 7 * 1 * 10 * 10 * 15 * 8 matrix
>p (ioc, ipc, irc, inw, ivw, ivdp, itp) = period_arr (ioc ipc, irc, inw, ipw, 
>ivdp, itp);
>n (ioc, ipc, irc, inw, ivw, ivdp, itp) = period_arr (ioc ipc, irc, inw, ipw, 
>ivdp, itp);

A comma is missing between ioc and ipc

>Code for picking up the distance and least value
>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);

Alright until here

>So based on the minimum distance i get the closest value

Yes.

>But, I have a problem here I have to get only the closest value where the
>indices inw of p = inw of n and ipw of p = ipw of n. It should regulate the
>same value for both p and n. 

I don't uderstand....

>Output example
>tp = [2.2, 2.4, 2.5, 2.6]

What is tp?

>Looking at this, the closest value is 2.2 or 2.4 wrt t1
>2.2 = period`_arr (i1, i2, i3, 4, 5, i6, i7)
>2.4 = period`_arr (i1, i2, i3, 3, 1, i6, i7)
>tn = [5.2, 5.4, 7.5, 5.8]
>Looking at this, the closest value is 5.4 or 5.8 wrt t2
>5.4 = period`_arr (i1, i2, i3, 1, 2, i6, i7)
>5.8 = period`_arr (i1, i2, i3, 4, 5, i6, i7)
>so i should choose 2.2 and 5.8 as the close c_tp and c_tn respectively
>since the the indices i4 of p = i4 of n and i5 of p = i5 of n. the other i
>values ​​can take any value

Sorry, I can't follow you.  You can try to make a simpler example, using
real matrices and numbers, and as few dimensions as possible.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it



reply via email to

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