Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Extraction of elements of an array inside the other array

1 visualización (últimos 30 días)
Ganesh Kini
Ganesh Kini el 4 de Abr. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Suppose i have
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 ? Kindly help me :)

Respuestas (1)

Walter Roberson
Walter Roberson el 4 de Abr. de 2020
period(t1,t2,t3) =time(p)
So t1, t2, t3 are subscripts, and time(p) is either a function or array that results in either a scalar or else a length(t1) by length(t2) by length(t3) array. Afterwards, period will be max(t1) by max(t2) by max(t3) in size.
t1 = (1,3,4,6,8,9,0,5,4,)
0 is not a valid index, so t1 cannot be used as a subscript for an array.
For the sake of continuing the discussion, let us instead say
t1 = [1,3,4,6,8,9,10,5,4]
t2 = [3]
t3 = [4,56,7,8,5,1]
and now we know that whatever time(p) is, it must be either a scalar or else a 9 x 1 x 6 array
i want to show the 5th element of t1 as the output.
t1(5)
but what does that have to do with "inside another array" ??
  9 comentarios
Ganesh Kini
Ganesh Kini el 6 de Abr. de 2020
Thank you.
If you have spare time, could you please explain me the above code ?
Ganesh Kini
Ganesh Kini el 7 de Abr. de 2020
Hi,
after looking at the existing code and analysis.
period_fun(a,b,c)=time(p);
period_fun is not a function, its just an array.
Could you please let me know how to access the elements passed to it ?

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by