"How do I get the list of years in TR?"
A timerange object is opaque; there are no user functions to query one; it can only directly be used as a subscript into a timetable. Therefore, one has to go at it indirectly... S=struct(TR)
Warning: Calling STRUCT on an object prevents the object from hiding its implementation details and should thus be avoided. Use DISP or DISPLAY to see the visible public details of an object. See 'help struct' for more information.
S =
first: 01/09/2024
last: 29/11/2024
type: 'openright'
first_matchTimeZone: 0
last_matchTimeZone: 0
unitOfTime: ''
hasEventFilters: 0
version: 1.4000
So, we query and dsplay the piece of interest in the struct to determine what the field names inside the object are and then extract the piece of data of interest.
"But I want to select the years in Pr_Year using the range of of Tr"
Create a new timerange with that year range--
TRyr=timerange(S.first,'years')
TRyr =
timetable timerange subscript:
Select timetable rows with times in the half-open interval:
Starting at, including: 01-Jan-2024 00:00:00
Ending at, but excluding: 01-Jan-2025 00:00:00
Note that even knowing the name of the TR object isn't enough--
TRyr=timerange(TR.first,'years')
No public property 'first' for class ''timerange''.
fails. You're not allowed to ask the object itself and there are no associated methods to allow a direct query...that would seem to be a reasonable enhancement if TMW wouldn't want to go so far as to make the internals visible.