help-octave
[Top][All Lists]
Advanced

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

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


From: Nicholas Jankowski
Subject: Re: Extraction of elements of an array inside the other array
Date: Sat, 4 Apr 2020 18:26:52 -0400

On Sat, Apr 4, 2020 at 5:40 PM GK19 <address@hidden> 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 =  8

arrays are defined with [] not ()

and you should learn about array indexing:
https://octave.org/doc/v5.2.0/Simple-Examples.html#Simple-Examples  
https://octave.org/doc/v5.2.0/Index-Expressions.html  
https://octave.org/doc/v5.2.0/  



reply via email to

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