Georacer / ardupilog

A ardupilot log to MATLAB converter
GNU General Public License v3.0
48 stars 36 forks source link

Added automatic fix if getSlice input arguments are reversed. #74

Closed hunt0r closed 5 years ago

hunt0r commented 5 years ago

I accidentally called getSlice([val1 val2], 'TimeS') and was surprised when no error occurred, but also no data was sliced. This elegantly fixes that easy mistake for the user... if you like it. If you'd prefer the software simply returns an error when the user makes a mistake, rather than doing what was meant, that's also fine with me.

Georacer commented 5 years ago

Since it's still fresh for you, can you remind me why it should be an error?

Georacer commented 5 years ago

Oh, I see now. I think it should error out. Since the API says type first and then interval, we should respect it. If we ever add unit tests (in a parallel universe) it would be hard to catch such a case. Plus, it's always hard to guess the intention of the user.

Georacer commented 5 years ago

Upon further inspection, I see that the correct call is: function slice = getSlice(obj, slice_values, slice_type)

Did you make a typo when you wrote getSlice([val1 val2], 'TimeS') in the first post?

hunt0r commented 5 years ago

Yeah, that was a typo, sorry.

Anyways, I'm happy to just have it throw an error instead. I'll close the request and issue a different one with the error message.