Accessing the output individually

조회 수: 2 (최근 30일)
im db d
im db d 2015년 6월 30일
댓글: Stephen23 2015년 6월 30일
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
Stephen23
Stephen23 2015년 6월 30일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Sid
Sid 2015년 6월 30일
Perhaps try timeValues = [logfile_P.time] to make a vector and then extract timeValues(1:25) ?

추가 답변 (1개)

Sid
Sid 2015년 6월 30일
편집: Sid 2015년 6월 30일
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.

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by