Accessing the output individually

1 visualización (últimos 30 días)
im db d
im db d el 30 de Jun. de 2015
Comentada: Stephen23 el 30 de Jun. de 2015
Dear All, could you please tell me, how can i access each element of the output result? for example, to get 16.6056 as output.
Thank you in advance.
>> logfile_P(1,1:25).time
ans =
16.6056
ans =
21.7406
ans =
26.8590
ans =
32.0106
ans =
37.1623
ans =
57.7857
ans =
62.9207
ans =
68.0890
ans =
73.2240
ans =
78.3590
ans =
140.1291
ans =
145.2807
ans =
150.4324
ans =
155.5674
ans =
160.7024
ans =
181.3091
ans =
186.4441
ans =
191.5958
ans =
196.7308
ans =
201.8825
ans =
263.6858
ans =
268.8042
ans =
273.9392
ans =
279.0575
ans =
284.1925
>> logfile_P
logfile_P =
1x50 struct array with fields:
trial
event_type
code
time
ttime
uncertainty
duration
uncertainty_1
reqtime
reqdur
stim_type
pair_index
  1 comentario
Stephen23
Stephen23 el 30 de Jun. de 2015
If you only want one element (e.g. 16.6056 as stated in the question), then just index into the structure:
logfile_P(1).time

Iniciar sesión para comentar.

Respuesta aceptada

Sid
Sid el 30 de Jun. de 2015
Perhaps try timeValues = [logfile_P.time] to make a vector and then extract timeValues(1:25) ?

Más respuestas (1)

Sid
Sid el 30 de Jun. de 2015
Editada: Sid el 30 de Jun. de 2015
This is beyond the scope of the original question, but you could also try struct2table (read here .) to complete the structure to a table data format.
Again, simply an alternative option, but thought I put a note in case someone finds it useful.
HTH.

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by