-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning in duration constructor: "colon arguments should be scalars" #134
Comments
Thanks for the bug report, @jgpallero. This looks like an easy fix. I think I can get this out in a patch release in the next few days. DiagnosisI can reproduce this, with Tablicious 0.4.2 under Octave 8.4.0 on macOS 14 (Apple Silicon).
That “parseTimeStringsToDatenum” is a static method inside the duration.m classdef file inside Tablicious. Looking at the source code there, around line 563: for i = 1:size (strs)
strIn = strs{i}; Oopsie. That should be “1:numel(strs)”, not “1:size(strs)”. Rookie mistake. And this bug might well produce incorrect results instead of just raising a warning. That’s an easy one-liner fix. And it’s about time to roll out a new Tablicious release anyway. TODO for me
|
Hi, I add some strange behavior of duration. In this case, when I try to use as input argument a cell array of strings. These are the results in Matlab:
but in Octave:
Apart of the warning, when I use the cell with comma as elements separator the function returns a NaT signal for the second value |
I think this is another effect of the E.g.:
When I replace that
|
…tr row vectors The `for i = 1:size (strs)` is a bug; it should be `numel (strs)`. When using `size()`, you get a vector, then I think the `1:x` colon operator just uses the first element of the RHS, so it under-counts if dim 2 or higher is nonzero, and leaves the ignored elements as NaN in the output. See: #134
Here's a proposed fix, on branch fix-duration-ctor, in commit 66ac059. (Updated version: a77a220.) After:
|
…tr row vectors The `for i = 1:size (strs)` is a bug; it should be `numel (strs)`. When using `size()`, you get a vector, then I think the `1:x` colon operator just uses the first element of the RHS, so it under-counts if dim 2 or higher is nonzero, and leaves the ignored elements as NaN in the output. See: #134
I'm pretty confident this is a good fix, and feeling impatient today, plus the other changes on The release is published on GitHub now; working on getting it in to the Octave Packages index; here's gnu-octave/packages PR #479 for it. Closing this as Fixed. Please re-open this issue if it's still broken on the main branch or in the 0.4.3 release. |
I'm working with tablicious' duration function with input as text mode and I can see that in this format a warning is emitted:
Otherwise it works OK.
The text was updated successfully, but these errors were encountered: