From 0d99093bc3e3b351a3f82243d76a272e11b90add Mon Sep 17 00:00:00 2001 From: Kevin Gurney Date: Mon, 25 Sep 2023 11:55:25 -0400 Subject: [PATCH] Modify display for Array. --- matlab/src/cpp/arrow/matlab/array/proxy/array.cc | 4 ++-- matlab/src/matlab/+arrow/+array/Array.m | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/matlab/src/cpp/arrow/matlab/array/proxy/array.cc b/matlab/src/cpp/arrow/matlab/array/proxy/array.cc index 6e7ceff7378bb..50202124bf2f3 100644 --- a/matlab/src/cpp/arrow/matlab/array/proxy/array.cc +++ b/matlab/src/cpp/arrow/matlab/array/proxy/array.cc @@ -51,8 +51,8 @@ namespace arrow::matlab::array::proxy { arrow::PrettyPrintOptions options; options.window = 3; options.skip_new_lines = true; - options.include_braces = false; - options.delimiter = " "; + options.include_braces = true; + options.delimiter = ", "; // MATLAB array display uses 5 spaces between elements. MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(arrow::PrettyPrint(*array, options, &strs), context, error::ARRAY_DISPLAY_FAILED); const auto str_utf8 = strs.str(); diff --git a/matlab/src/matlab/+arrow/+array/Array.m b/matlab/src/matlab/+arrow/+array/Array.m index 436d5b80aa6a8..0caa1eb0cb3fd 100644 --- a/matlab/src/matlab/+arrow/+array/Array.m +++ b/matlab/src/matlab/+arrow/+array/Array.m @@ -62,9 +62,14 @@ end methods (Access=protected) + function displayScalarObject(obj) - disp(obj.toString()); + className = matlab.mixin.CustomDisplay.getClassNameForHeader(obj); + indent = " "; + disp("Arrow " + className + " with "+ obj.Length + " elements:") + disp(newline + indent + obj.toString() + newline); end + end methods