MCPcopy Create free account
hub / github.com/apache/arrow / toMATLAB

Method toMATLAB

matlab/src/cpp/arrow/matlab/array/proxy/numeric_array.h:76–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74
75 protected:
76 void toMATLAB(libmexclass::proxy::method::Context& context) {
77 using CType = typename arrow::TypeTraits<ArrowType>::CType;
78 using NumericArray = arrow::NumericArray<ArrowType>;
79
80 const auto num_elements = static_cast<size_t>(array->length());
81 const auto numeric_array = std::static_pointer_cast<NumericArray>(array);
82 const CType* const data_begin = numeric_array->raw_values();
83 const CType* const data_end = data_begin + num_elements;
84
85 ::matlab::data::ArrayFactory factory;
86
87 // Constructs a TypedArray from the raw values. Makes a copy.
88 ::matlab::data::TypedArray<CType> result =
89 factory.createArray({num_elements, 1}, data_begin, data_end);
90 context.outputs[0] = result;
91 }
92};
93} // namespace arrow::matlab::array::proxy

Callers

nothing calls this directly

Calls 2

lengthMethod · 0.45
raw_valuesMethod · 0.45

Tested by

no test coverage detected