Commits


Kevin Gurney authored and GitHub committed 88339cd8aa0
GH-35550: [MATLAB] Add public `toMATLAB` method to `arrow.array.Array` for converting to MATLAB types (#35551) ### Rationale for this change In order to allow clients to write generic code for different concrete `arrow.array.Array` subclasses in MATLAB, it would be helpful to have one generic `toMATLAB` method. `toMATLAB` would convert the `arrow.array.Array` into a corresponding MATLAB type. For example, `arrow.array.Float64Array` would be converted to a MATLAB `double` array. ```matlab >> doubleMatlabArray = toMATLAB(float64ArrowArray) % Convert the arrow.array.Float64Array to a MATLAB double array ``` ### What changes are included in this PR? 1. Added a public `toMATLAB` method to the `arrow.array.Array` superclass. Example of using `toMATLAB` on an `arrow.array.Float64Array`: ```matlab >> arrowArray = arrow.array.Float64Array(1:10) arrowArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] >> matlabArray = toMATLAB(arrowArray) matlabArray = 1 2 3 4 5 6 7 8 9 10 >> class(matlabArray) ans = 'double' ``` ### Are these changes tested? 1. Yes, we added tests for `toMATLAB` to `tFloat32Array.m` and `tFloat64Array.m`. 2. This was qualified on a Debian 11 machine. ### Future Directions 1. Move the `toMATLAB` tests to the shared test utility class (i.e. #35537). ### Notes 1. Thanks to @ sgilmore10 for her help with this pull request! * Closes: #35550 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Sutou Kouhei <kou@clear-code.com>