Convert timetables, like tables - #253
Open
Thenewmanator15 wants to merge 1 commit into
Open
Thenewmanator15 wants to merge 1 commit into
Thenewmanator15 wants to merge 1 commit into
Conversation
A timetable was returned as a MatlabOpaque, its parts decoded but not assembled.
It now becomes a table (MatlabTable by default, or the `table` type) whose first
column holds the row times, named after the row dimension ("Time" unless renamed),
followed by the variables.
Row times are stored one per row (datetime or duration, already converted to
DateTime or Millisecond), or, for a regular timetable, as a start time and a sample
rate or time step; those are generated. A timetable stepped in calendar units has
no fixed rate and is left as the MatlabOpaque, with a warning. `table=Nothing`
keeps the raw object, as for tables.
test/timetable_gen.m writes test/v7 and test/v7.3/timetable.mat: datetime and
duration row times, sample rate, time step from a datetime start, an empty
timetable, a two-column variable, a renamed row dimension, calendar months. The
.mat files are not included; the timetable tests are skipped until they are
generated in MATLAB and committed.
This was referenced Sep 25, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A MATLAB
timetableis read as aMatlabOpaque: its parts (variable names, data, row times, units) are all decoded, but never assembled. This converts it the waytablealready is — toMatlabTableby default, or to thetabletype (DataFrame, ...) — with the row times as the first column, named after the row dimension (Timeunless renamed).Row times, in the forms MATLAB saves them:
datetimeorduration— already converted toDateTime/Millisecondby the time the timetable is;SampleRateorTimeStep), which MATLAB stores as a start time plus a rate or step — the row times are generated;calmonths, ...) has no fixed rate: the timetable is left as theMatlabOpaque, with a warning.table = Nothingkeeps the raw object, as for tables.Tests, and a request.
test/timetable_gen.mwritestest/v7/timetable.matandtest/v7.3/timetable.matwith one variable per case — datetime and duration row times (sub-millisecond ones included), sample rate, time step from a datetime start, an empty timetable, a two-column variable, a renamed row dimension, and calendar months. I can't contribute the.matfiles themselves, so they are not in this PR: could someone with MATLAB run the script intest/and commit its two files? Until then the new testset skips (@test_skip), so CI stays green. Run locally against the files the script writes (MATLAB R2025a), all 48 new assertions pass and the full suite passes (629) on Julia 1.13;read.jlalso passes on 1.9. Without the files: 581 pass, 2 skipped.I also checked it on a real acquisition file (v7.3, a user-defined class holding four timetables, one of them empty): every value matches two other readers of the same file, and the row times agree to within
DateTime's millisecond resolution.A note on
ms_to_datetime, which asks whether the imaginary part of a stored datetime is the sub-millisecond part: it is the low half of a double-double, below the resolution of the real part (on that file, |imag| ≤ half an ulp of the real part in every row), soreal + imaginFloat64equalsrealand dropping it loses nothing atDateTimeresolution. The sub-millisecond detail is the real part's own fraction, whichDateTimerounds away.Independent of #251 (no overlapping lines); docs: a
timetablerow indocs/src/types.mdand thematopen/matreaddocstrings.🤖 Generated with Claude Code