# Extraction of elements of an array inside the other array

9 messages
Open this post in threaded view
|

## Extraction of elements of an array inside the other array

 period (t1, t2, t3) = time (p) where t1 , t2, t3 are n dimensional arrays say   t1 = (1,3,4,6,8,9,0,5,4,) t2 = (3) t3 = (4,56,7,8,5,1) i want to show the 5th element of t1 as the output. Output should be 8 how do i do that? -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: Extraction of elements of an array inside the other array

 Administrator On Sat, Apr 4, 2020 at 5:40 PM GK19 <[hidden email]> wrote:period (t1, t2, t3) = time (p) where t1 , t2, t3 are n dimensional arrays say  t1 = (1,3,4,6,8,9,0,5,4,) t2 = (3) t3 = (4,56,7,8,5,1) i want to show the 5th element of t1 as the output. Output should be 8 how do i do that? octave:1> t1 = [1,3,4,6,8,9,0,5,4];octave:2> t1(5)ans =  8arrays are defined with [] not ()and you should learn about array indexing:
Open this post in threaded view
|

## Re: Extraction of elements of an array inside the other array

 I will try to explain this way Period (5,1,3) = 12 so the value of time is 12 Now i have trace back by taking the value of time ie 12, i need to get the value of the 5th element of t1 is it possible? -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: Extraction of elements of an array inside the other array

 Ganesh Rkini: >I will try to explain this way >Period (5,1,3) = 12 >so the value of time is 12 Is Period a multidim array or a function? >Now i have trace back by taking the value of time ie 12, i need to get the >value of the 5th element of t1 What is t1? -- 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
Open this post in threaded view
|

## Re: Extraction of elements of an array inside the other array

 Is Period a multidim array or a function? -- Yes it is a function What is t1? -- period (t1, t2, t3) = time (p) where t1 , t2, t3 are n dimensional arrays say   t1 = (1,3,4,6,8,9,0,5,4,) t2 = (3) t3 = (4,56,7,8,5,1) t1 is a n dimensional array -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: Extraction of elements of an array inside the other array

 Administrator On Sun, Apr 5, 2020, 8:40 AM GK19 <[hidden email]> wrote: Is Period a multidim array or a function? -- Yes it is a function What is t1? -- period (t1, t2, t3) = time (p) where t1 , t2, t3 are n dimensional arrays say  t1 = (1,3,4,6,8,9,0,5,4,) t2 = (3) t3 = (4,56,7,8,5,1) t1 is a n dimensional arrayI think we need more information about what you're trying to do. Can you share a minimal code example?
Open this post in threaded view
|

## Re: Extraction of elements of an array inside the other array

 period (t1, t2, t3) = time (p) where t1 , t2, t3 are n dimensional arrays say   a = (1,3,4,6,8,9,0,5,4,) b = (3) c = (4,56,7,8,5,1) t1 = length(a) t2 = length(b) t1 = length(c) Since I have a function called period it gives some random value based on the parameters that have been passed to t1, t2, t3. output -- period (5,1,2) = 12. what I'm trying is to do trace it back i have time as 12, just by looking at the output i want to trace the value of t1 that has been passed. so my output so look like 8, which is the 5th element of a. how can i do that ? kindly help -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html