Commits


sgilmore10 authored and GitHub committed e18ace31522
GH-38415: [MATLAB] Add indexing "slice" method to C++ Array Proxy class (#38674) ### Rationale for this change In order to support MATLAB indexing semantics on the `arrow.array.Array` classes, we first need to add a method for "slicing" an Arrow Array to the C++ Array Proxy classes. ### What changes are included in this PR? 1. Added a `slice` method to the C++ Arrow Array Proxy class. 2. Added a `slice` method to `arrow.array.Array`. This method invokes the `slice` method on the proxy class. **Example** ```matlab >> a = arrow.array([1 2 NaN 4 5 NaN 7]) a = Float64Array with 7 elements and 2 null values: 1 | 2 | null | 4 | 5 | null | 7 % Note: MATLAB uses 1-based indexing. >> slice = a.slice(int64(2), int64(4)) slice = Float64Array with 4 elements and 1 null value: 2 | null | 4 | 5 ``` ### Are these changes tested? Yes, added a new test file called `tSlice.m`. ### Are there any user-facing changes? The `slice` method is public, but [hidden](https://www.mathworks.com/help/matlab/matlab_oop/method-attributes.html). * Closes: #38415 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>