kevingurney commented on code in PR #45973:
URL: https://github.com/apache/arrow/pull/45973#discussion_r2029299904


##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -131,33 +119,43 @@ Alternatively, they could directly convert from an 
existing MATLAB `table` to an
 
 >> Density = [10.2; 20.5; 11.2; 13.7; 17.8]; 
 
->> T = table(Weight, Radius, Density); % Create a MATLAB table 
+% Create a MATLAB `table`
+>> T = table(Weight, Radius, Density);
 
->> AT = arrow.matlab2arrow(T); % Create an arrow.Table 
+% Create an `arrow.tabular.Table` from the MATLAB `table`
+>> AT = arrow.table(T);
 ```
-To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.FeatherTableWriter`. 
+
+To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.internal.io.feather.Writer`. 
 
 ###### Example Code: 
 ``` matlab
->> featherTableWriter = arrow.FeatherTableWriter(); 
-
->> featherTableWriter.write(AT, "data.feather"); 
+% Make an `arrow.tabular.RecordBatch` from the `arrow.tabular.Table` created 
in the previous step
+>> recordBatch = arrow.recordBatch(AT);
+>> filename = "data.arrow";
+% Write the `arrow.tabular.RecordBatch` using Feather locally to `data.arrow`

Review Comment:
   ```suggestion
   % Write the `arrow.tabular.RecordBatch` to disk as a Feather V1 file named 
`data.feather`
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -131,33 +119,43 @@ Alternatively, they could directly convert from an 
existing MATLAB `table` to an
 
 >> Density = [10.2; 20.5; 11.2; 13.7; 17.8]; 
 
->> T = table(Weight, Radius, Density); % Create a MATLAB table 
+% Create a MATLAB `table`
+>> T = table(Weight, Radius, Density);
 
->> AT = arrow.matlab2arrow(T); % Create an arrow.Table 
+% Create an `arrow.tabular.Table` from the MATLAB `table`
+>> AT = arrow.table(T);
 ```
-To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.FeatherTableWriter`. 
+
+To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.internal.io.feather.Writer`. 
 
 ###### Example Code: 
 ``` matlab
->> featherTableWriter = arrow.FeatherTableWriter(); 
-
->> featherTableWriter.write(AT, "data.feather"); 
+% Make an `arrow.tabular.RecordBatch` from the `arrow.tabular.Table` created 
in the previous step
+>> recordBatch = arrow.recordBatch(AT);
+>> filename = "data.arrow";

Review Comment:
   To make it clear that this is Feather V1 and *NOT* Feather V2 (i.e. the 
Arrow IPC format), I think it would be better to use the extension `.feather` 
here.
   
   ```suggestion
   >> filename = "data.feather";
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -179,47 +177,65 @@ Roughly speaking, local memory sharing workflows can be 
divided into two categor
 
 To share a MATLAB `arrow.Array` with PyArrow efficiently, a user could use the 
`exportToCDataInterface` method to export the Arrow memory wrapped by an 
`arrow.Array` to the C Data Interface format, consisting of two C-style 
structs, [`ArrowArray`] and [`ArrowSchema`], which represent the Arrow data and 
associated metadata. 
 
-Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `exportToCDataInterface`. These addresses can be passed to Python 
directly, without having to make any copies of the underlying Arrow data 
structures that they refer to. A user can then wrap the underlying data pointed 
to by the `ArrowArray` struct (which is already in the [Arrow Columnar 
Format]), as well as extract the necessary metadata from the `ArrowSchema` 
struct, to create a `pyarrow.Array` by using the static method 
`py.pyarrow.Array._import_from_c`. 
+Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `export`. These addresses can be passed to Python directly, without 
having to make any copies of the underlying Arrow data structures that they 
refer to. A user can then wrap the underlying data pointed to by the 
`ArrowArray` struct (which is already in the [Arrow Columnar Format]), as well 
as extract the necessary metadata from the `ArrowSchema` struct, to create a 
`pyarrow.Array` by using the static method `pyarrow.Array._import_from_c`. 
+
+Since we require multiple lines to import our matlab Arrow array into python, 
we'll use a function called `pyrunfile`, which allows us to [execute Python 
statements in a file supplied as an argument to the 
function](https://www.mathworks.com/help/matlab/ref/pyrunfile.html).

Review Comment:
   ```suggestion
   Multiple lines of Python are required to import the Arrow array from MATLAB. 
Therefore, the function 
[`pyrunfile`]((https://www.mathworks.com/help/matlab/ref/pyrunfile.html)) can 
be used when can run Python scripts defined in an external file.
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -179,47 +177,65 @@ Roughly speaking, local memory sharing workflows can be 
divided into two categor
 
 To share a MATLAB `arrow.Array` with PyArrow efficiently, a user could use the 
`exportToCDataInterface` method to export the Arrow memory wrapped by an 
`arrow.Array` to the C Data Interface format, consisting of two C-style 
structs, [`ArrowArray`] and [`ArrowSchema`], which represent the Arrow data and 
associated metadata. 
 
-Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `exportToCDataInterface`. These addresses can be passed to Python 
directly, without having to make any copies of the underlying Arrow data 
structures that they refer to. A user can then wrap the underlying data pointed 
to by the `ArrowArray` struct (which is already in the [Arrow Columnar 
Format]), as well as extract the necessary metadata from the `ArrowSchema` 
struct, to create a `pyarrow.Array` by using the static method 
`py.pyarrow.Array._import_from_c`. 
+Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `export`. These addresses can be passed to Python directly, without 
having to make any copies of the underlying Arrow data structures that they 
refer to. A user can then wrap the underlying data pointed to by the 
`ArrowArray` struct (which is already in the [Arrow Columnar Format]), as well 
as extract the necessary metadata from the `ArrowSchema` struct, to create a 
`pyarrow.Array` by using the static method `pyarrow.Array._import_from_c`. 
+
+Since we require multiple lines to import our matlab Arrow array into python, 
we'll use a function called `pyrunfile`, which allows us to [execute Python 
statements in a file supplied as an argument to the 
function](https://www.mathworks.com/help/matlab/ref/pyrunfile.html).
 
 ###### Example Code: 
+
+```python
+# file located in same directory as the matlab file, named import_from_c.py
+import pyarrow as pa
+array = pa.Array._import_from_c(arrayMemoryAddress, schemaMemoryAddress)
+```
+
 ``` matlab
 % Create a MATLAB arrow.Array. 
 >> AA = arrow.array([1, 2, 3, 4, 5]); 
 
+% Export C Data Interface C-style structs for `arrow.array.Array` values and 
schema
+>> cArray = arrow.c.Array();
+>> cSchema = arrow.c.Schema();
+
 % Export the MATLAB arrow.Array to the C Data Interface format, returning the 
 % memory addresses of the required ArrowArray and ArrowSchema C-style structs. 
->> [arrayMemoryAddress, schemaMemoryAddress] = AA.exportToCDataInterface(); 
+>> AA.export(cArray.Address, cSchema.Address); 
 
 % Import the memory addresses of the C Data Interface format structs to create 
a pyarrow.Array. 
->> PA = py.pyarrow.Array._import_from_c(arrayMemoryAddress, 
schemaMemoryAddress); 
+>> PA = pyrunfile("import_from_c.py", "array", 
arrayMemoryAddress=cArray.Address, schemaMemoryAddress=cSchema.Address);
 ```
 Conversely, a user can create an Arrow array using PyArrow and share it with 
MATLAB. To do this, they can call the method `_export_to_c` to export a 
`pyarrow.Array` to the C Data Interface format. 
 
-The memory addresses to the `ArrowArray` and `ArrowSchema` structs populated 
by the call to `_export_to_c` can be passed to the static method 
`arrow.Array.importFromCDataInterface` to construct a MATLAB `arrow.Array` with 
zero copies. 
+**NOTE:** Since the python calls to `_export_to_c` and `_import_from_c` have 
underscores at the beginning of their names, they cannot be called directly in 
MATLAB. MATLAB member functions or variables are [not allowed to start with an 
underscore](https://www.mathworks.com/help/matlab/matlab_prog/variable-names.html).
 
 
-The example code below is adapted from the [`test_cffi.py` test cases for 
PyArrow]. 
+To initialize a Python `pyarrow` array, the MATLAB `pyrunfile` command can be 
used, which supports the execution of Python code containing variables and 
functions with names that start with an underscore. 
+
+The memory addresses to the `ArrowArray` and `ArrowSchema` structs populated 
by the call to `_export_to_c` can be passed to the static method 
`arrow.Array.importFromCDataInterface` to construct a MATLAB `arrow.Array` with 
zero copies. 
 
 ###### Example Code: 
+
+```python
+# file located in same directory as the matlab file, named export_to_c.py

Review Comment:
   ```suggestion
   # Filename: export_to_c.py
   # Note: This file is located in same directory as the MATLAB file.
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -131,33 +119,43 @@ Alternatively, they could directly convert from an 
existing MATLAB `table` to an
 
 >> Density = [10.2; 20.5; 11.2; 13.7; 17.8]; 
 
->> T = table(Weight, Radius, Density); % Create a MATLAB table 
+% Create a MATLAB `table`
+>> T = table(Weight, Radius, Density);
 
->> AT = arrow.matlab2arrow(T); % Create an arrow.Table 
+% Create an `arrow.tabular.Table` from the MATLAB `table`
+>> AT = arrow.table(T);
 ```
-To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.FeatherTableWriter`. 
+
+To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.internal.io.feather.Writer`. 
 
 ###### Example Code: 
 ``` matlab
->> featherTableWriter = arrow.FeatherTableWriter(); 
-
->> featherTableWriter.write(AT, "data.feather"); 
+% Make an `arrow.tabular.RecordBatch` from the `arrow.tabular.Table` created 
in the previous step
+>> recordBatch = arrow.recordBatch(AT);
+>> filename = "data.arrow";
+% Write the `arrow.tabular.RecordBatch` using Feather locally to `data.arrow`
+>> writer = arrow.internal.io.feather.Writer(filename);
+>> writer.write(recordBatch);
 ```
-The Feather file could then be read and operated on by an external process 
like Rust or Go. To read it back into MATLAB after modification by another 
process, the user could instantiate an `arrow.FeatherTableReader`. 
+The Feather file could then be read and operated on by an external process 
like Rust or Go. To read it back into MATLAB after modification by another 
process, the user could instantiate an `arrow.internal.io.feather.Reader`. 
 
 ###### Example Code: 
 ``` matlab
->> featherTableReader = arrow.FeatherTableReader("data.feather"); 
+>> reader = arrow.internal.io.feather.Reader(filename);
 
->> AT = featherTableReader.read(); 
+% Read in the first RecordBatch
+>> newBatch = reader.read();
+
+% Create a MATLAB `table` from the `arrow.tabular.RecordBatch`
+>> AT = table(newBatch);
 ```
 #### Advanced MATLAB User Workflow for Implementing Support for Writing to 
Feather Files 
 
-To add support for writing to Feather files, an advanced MATLAB user could use 
the MATLAB and C++ APIs offered by the MATLAB Interface for Apache Arrow to 
create `arrow.FeatherTableWriter`. 
+To add support for writing to Feather files, an advanced MATLAB user could use 
the MATLAB and C++ APIs offered by the MATLAB Interface for Apache Arrow to 
create `arrow.internal.io.feather.Writer`. 

Review Comment:
   ```suggestion
   To add support for writing to Feather V1 files, an advanced MATLAB user 
could use the MATLAB and C++ APIs offered by the MATLAB Interface for Apache 
Arrow to create `arrow.internal.io.feather.Writer`. 
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -179,47 +177,65 @@ Roughly speaking, local memory sharing workflows can be 
divided into two categor
 
 To share a MATLAB `arrow.Array` with PyArrow efficiently, a user could use the 
`exportToCDataInterface` method to export the Arrow memory wrapped by an 
`arrow.Array` to the C Data Interface format, consisting of two C-style 
structs, [`ArrowArray`] and [`ArrowSchema`], which represent the Arrow data and 
associated metadata. 
 
-Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `exportToCDataInterface`. These addresses can be passed to Python 
directly, without having to make any copies of the underlying Arrow data 
structures that they refer to. A user can then wrap the underlying data pointed 
to by the `ArrowArray` struct (which is already in the [Arrow Columnar 
Format]), as well as extract the necessary metadata from the `ArrowSchema` 
struct, to create a `pyarrow.Array` by using the static method 
`py.pyarrow.Array._import_from_c`. 
+Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `export`. These addresses can be passed to Python directly, without 
having to make any copies of the underlying Arrow data structures that they 
refer to. A user can then wrap the underlying data pointed to by the 
`ArrowArray` struct (which is already in the [Arrow Columnar Format]), as well 
as extract the necessary metadata from the `ArrowSchema` struct, to create a 
`pyarrow.Array` by using the static method `pyarrow.Array._import_from_c`. 

Review Comment:
   ```suggestion
   Memory addresses for the `ArrowArray` and `ArrowSchema` structs are returned 
by the call to `export`. These addresses can be passed to Python directly, 
without having to make any copies of the underlying Arrow data structures that 
they refer to. A user can then wrap the underlying data pointed to by the 
`ArrowArray` struct (which is already in the [Arrow Columnar Format]), as well 
as extract the necessary metadata from the `ArrowSchema` struct, to create a 
`pyarrow.Array` by using the static method `pyarrow.Array._import_from_c`. 
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -131,33 +119,43 @@ Alternatively, they could directly convert from an 
existing MATLAB `table` to an
 
 >> Density = [10.2; 20.5; 11.2; 13.7; 17.8]; 
 
->> T = table(Weight, Radius, Density); % Create a MATLAB table 
+% Create a MATLAB `table`
+>> T = table(Weight, Radius, Density);
 
->> AT = arrow.matlab2arrow(T); % Create an arrow.Table 
+% Create an `arrow.tabular.Table` from the MATLAB `table`
+>> AT = arrow.table(T);
 ```
-To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.FeatherTableWriter`. 
+
+To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.internal.io.feather.Writer`. 
 
 ###### Example Code: 
 ``` matlab
->> featherTableWriter = arrow.FeatherTableWriter(); 
-
->> featherTableWriter.write(AT, "data.feather"); 
+% Make an `arrow.tabular.RecordBatch` from the `arrow.tabular.Table` created 
in the previous step
+>> recordBatch = arrow.recordBatch(AT);
+>> filename = "data.arrow";
+% Write the `arrow.tabular.RecordBatch` using Feather locally to `data.arrow`
+>> writer = arrow.internal.io.feather.Writer(filename);
+>> writer.write(recordBatch);
 ```
-The Feather file could then be read and operated on by an external process 
like Rust or Go. To read it back into MATLAB after modification by another 
process, the user could instantiate an `arrow.FeatherTableReader`. 
+The Feather file could then be read and operated on by an external process 
like Rust or Go. To read it back into MATLAB after modification by another 
process, the user could instantiate an `arrow.internal.io.feather.Reader`. 

Review Comment:
   ```suggestion
   The Feather file could then be read and operated on by an external process 
like Rust or Go. To read it back into MATLAB, the user could instantiate an 
`arrow.internal.io.feather.Reader`. 
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -131,33 +119,43 @@ Alternatively, they could directly convert from an 
existing MATLAB `table` to an
 
 >> Density = [10.2; 20.5; 11.2; 13.7; 17.8]; 
 
->> T = table(Weight, Radius, Density); % Create a MATLAB table 
+% Create a MATLAB `table`
+>> T = table(Weight, Radius, Density);
 
->> AT = arrow.matlab2arrow(T); % Create an arrow.Table 
+% Create an `arrow.tabular.Table` from the MATLAB `table`
+>> AT = arrow.table(T);
 ```
-To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.FeatherTableWriter`. 
+
+To serialize the `arrow.Table`, `AT`, to a file (e.g. Feather) on disk, the 
user could then instantiate an `arrow.internal.io.feather.Writer`. 
 
 ###### Example Code: 
 ``` matlab
->> featherTableWriter = arrow.FeatherTableWriter(); 
-
->> featherTableWriter.write(AT, "data.feather"); 
+% Make an `arrow.tabular.RecordBatch` from the `arrow.tabular.Table` created 
in the previous step
+>> recordBatch = arrow.recordBatch(AT);
+>> filename = "data.arrow";
+% Write the `arrow.tabular.RecordBatch` using Feather locally to `data.arrow`
+>> writer = arrow.internal.io.feather.Writer(filename);
+>> writer.write(recordBatch);
 ```
-The Feather file could then be read and operated on by an external process 
like Rust or Go. To read it back into MATLAB after modification by another 
process, the user could instantiate an `arrow.FeatherTableReader`. 
+The Feather file could then be read and operated on by an external process 
like Rust or Go. To read it back into MATLAB after modification by another 
process, the user could instantiate an `arrow.internal.io.feather.Reader`. 
 
 ###### Example Code: 
 ``` matlab
->> featherTableReader = arrow.FeatherTableReader("data.feather"); 
+>> reader = arrow.internal.io.feather.Reader(filename);
 
->> AT = featherTableReader.read(); 
+% Read in the first RecordBatch
+>> newBatch = reader.read();
+
+% Create a MATLAB `table` from the `arrow.tabular.RecordBatch`
+>> AT = table(newBatch);
 ```
 #### Advanced MATLAB User Workflow for Implementing Support for Writing to 
Feather Files 
 
-To add support for writing to Feather files, an advanced MATLAB user could use 
the MATLAB and C++ APIs offered by the MATLAB Interface for Apache Arrow to 
create `arrow.FeatherTableWriter`. 
+To add support for writing to Feather files, an advanced MATLAB user could use 
the MATLAB and C++ APIs offered by the MATLAB Interface for Apache Arrow to 
create `arrow.internal.io.feather.Writer`. 
 
 They would need to author a [MEX function] (e.g. `featherwriteMEX`), which can 
be called directly by MATLAB code. Within their MEX function, they could use 
`arrow::matlab::unwrap_table` to convert between the MATLAB representation of 
the Arrow memory (`arrow.Table`) and the equivalent C++ representation 
(`arrow::Table`). Once the `arrow.Table` has been "unwrapped" into a C++ 
`arrow::Table`, it can be passed to the appropriate Arrow C++ library API for 
writing to a Feather file (`arrow::ipc::feather::WriteTable`). 
 
-An analogous workflow could be followed to create `arrow.FeatherTableReader` 
to enable reading from Feather files. 
+An analogous workflow could be followed to create 
`arrow.internal.io.feather.Reader` to enable reading from Feather files. 

Review Comment:
   ```suggestion
   An analogous workflow could be followed to create 
`arrow.internal.io.feather.Reader` to enable reading from Feather V1 files. 
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -179,47 +177,65 @@ Roughly speaking, local memory sharing workflows can be 
divided into two categor
 
 To share a MATLAB `arrow.Array` with PyArrow efficiently, a user could use the 
`exportToCDataInterface` method to export the Arrow memory wrapped by an 
`arrow.Array` to the C Data Interface format, consisting of two C-style 
structs, [`ArrowArray`] and [`ArrowSchema`], which represent the Arrow data and 
associated metadata. 
 
-Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `exportToCDataInterface`. These addresses can be passed to Python 
directly, without having to make any copies of the underlying Arrow data 
structures that they refer to. A user can then wrap the underlying data pointed 
to by the `ArrowArray` struct (which is already in the [Arrow Columnar 
Format]), as well as extract the necessary metadata from the `ArrowSchema` 
struct, to create a `pyarrow.Array` by using the static method 
`py.pyarrow.Array._import_from_c`. 
+Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `export`. These addresses can be passed to Python directly, without 
having to make any copies of the underlying Arrow data structures that they 
refer to. A user can then wrap the underlying data pointed to by the 
`ArrowArray` struct (which is already in the [Arrow Columnar Format]), as well 
as extract the necessary metadata from the `ArrowSchema` struct, to create a 
`pyarrow.Array` by using the static method `pyarrow.Array._import_from_c`. 
+
+Since we require multiple lines to import our matlab Arrow array into python, 
we'll use a function called `pyrunfile`, which allows us to [execute Python 
statements in a file supplied as an argument to the 
function](https://www.mathworks.com/help/matlab/ref/pyrunfile.html).
 
 ###### Example Code: 
+
+```python
+# file located in same directory as the matlab file, named import_from_c.py

Review Comment:
   ```suggestion
   # Filename: import_from_c.py
   # Note: This file is located in same directory as the MATLAB file.
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -179,47 +177,65 @@ Roughly speaking, local memory sharing workflows can be 
divided into two categor
 
 To share a MATLAB `arrow.Array` with PyArrow efficiently, a user could use the 
`exportToCDataInterface` method to export the Arrow memory wrapped by an 
`arrow.Array` to the C Data Interface format, consisting of two C-style 
structs, [`ArrowArray`] and [`ArrowSchema`], which represent the Arrow data and 
associated metadata. 
 
-Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `exportToCDataInterface`. These addresses can be passed to Python 
directly, without having to make any copies of the underlying Arrow data 
structures that they refer to. A user can then wrap the underlying data pointed 
to by the `ArrowArray` struct (which is already in the [Arrow Columnar 
Format]), as well as extract the necessary metadata from the `ArrowSchema` 
struct, to create a `pyarrow.Array` by using the static method 
`py.pyarrow.Array._import_from_c`. 
+Memory addresses to the `ArrowArray` and `ArrowSchema` structs are returned by 
the call to `export`. These addresses can be passed to Python directly, without 
having to make any copies of the underlying Arrow data structures that they 
refer to. A user can then wrap the underlying data pointed to by the 
`ArrowArray` struct (which is already in the [Arrow Columnar Format]), as well 
as extract the necessary metadata from the `ArrowSchema` struct, to create a 
`pyarrow.Array` by using the static method `pyarrow.Array._import_from_c`. 
+
+Since we require multiple lines to import our matlab Arrow array into python, 
we'll use a function called `pyrunfile`, which allows us to [execute Python 
statements in a file supplied as an argument to the 
function](https://www.mathworks.com/help/matlab/ref/pyrunfile.html).
 
 ###### Example Code: 
+
+```python
+# file located in same directory as the matlab file, named import_from_c.py
+import pyarrow as pa
+array = pa.Array._import_from_c(arrayMemoryAddress, schemaMemoryAddress)
+```
+
 ``` matlab
 % Create a MATLAB arrow.Array. 
 >> AA = arrow.array([1, 2, 3, 4, 5]); 
 
+% Export C Data Interface C-style structs for `arrow.array.Array` values and 
schema
+>> cArray = arrow.c.Array();
+>> cSchema = arrow.c.Schema();
+
 % Export the MATLAB arrow.Array to the C Data Interface format, returning the 
 % memory addresses of the required ArrowArray and ArrowSchema C-style structs. 
->> [arrayMemoryAddress, schemaMemoryAddress] = AA.exportToCDataInterface(); 
+>> AA.export(cArray.Address, cSchema.Address); 
 
 % Import the memory addresses of the C Data Interface format structs to create 
a pyarrow.Array. 
->> PA = py.pyarrow.Array._import_from_c(arrayMemoryAddress, 
schemaMemoryAddress); 
+>> PA = pyrunfile("import_from_c.py", "array", 
arrayMemoryAddress=cArray.Address, schemaMemoryAddress=cSchema.Address);
 ```
 Conversely, a user can create an Arrow array using PyArrow and share it with 
MATLAB. To do this, they can call the method `_export_to_c` to export a 
`pyarrow.Array` to the C Data Interface format. 
 
-The memory addresses to the `ArrowArray` and `ArrowSchema` structs populated 
by the call to `_export_to_c` can be passed to the static method 
`arrow.Array.importFromCDataInterface` to construct a MATLAB `arrow.Array` with 
zero copies. 
+**NOTE:** Since the python calls to `_export_to_c` and `_import_from_c` have 
underscores at the beginning of their names, they cannot be called directly in 
MATLAB. MATLAB member functions or variables are [not allowed to start with an 
underscore](https://www.mathworks.com/help/matlab/matlab_prog/variable-names.html).
 
 
-The example code below is adapted from the [`test_cffi.py` test cases for 
PyArrow]. 
+To initialize a Python `pyarrow` array, the MATLAB `pyrunfile` command can be 
used, which supports the execution of Python code containing variables and 
functions with names that start with an underscore. 

Review Comment:
   ```suggestion
   To initialize a Python `pyarrow` array, `pyrunfile` can (again) be used to 
execute a Python script containing containing variables and functions with 
names that start with an underscore. 
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -240,7 +256,18 @@ For large tables used in a multi-process "data processing 
pipeline", a user coul
 >> AT = arrow.Table(Var1, Var2, Var3); 
 
 % Write the MATLAB arrow.Table to the Arrow IPC File Format on disk. 
->> arrow.ipcwrite(AT, "data.arrow"); 
+>> recordBatch = arrow.recordBatch(AT);
+
+>> filename = "data.arrow"
+
+% open `data.arrow` as an IPC file

Review Comment:
   ```suggestion
   % Open `data.arrow` as an IPC file
   ```



##########
matlab/doc/matlab_interface_for_apache_arrow_design.md:
##########
@@ -240,7 +256,18 @@ For large tables used in a multi-process "data processing 
pipeline", a user coul
 >> AT = arrow.Table(Var1, Var2, Var3); 
 
 % Write the MATLAB arrow.Table to the Arrow IPC File Format on disk. 
->> arrow.ipcwrite(AT, "data.arrow"); 
+>> recordBatch = arrow.recordBatch(AT);
+
+>> filename = "data.arrow"
+
+% open `data.arrow` as an IPC file
+>> writer = arrow.io.ipc.RecordBatchFileWriter(filename, recordBatch.Schema);
+
+% write the `RecordBatch` to `data.arrow`

Review Comment:
   ```suggestion
   % Write the `RecordBatch` to `data.arrow`
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to