Main Content

collect

Class: matlab.compiler.mlspark.RDD
Package: matlab.compiler.mlspark

Return a MATLAB cell array that contains all of the elements in an RDD

Syntax

result = collect(obj)

Description

result = collect(obj) returns a MATLAB® cell array that contains all of the elements in obj.

Input Arguments

expand all

An input RDD, specified as an RDD object.

Output Arguments

expand all

Elements of an RDD, returned as a cell array.

Examples

expand all

%% Connect to Spark
sparkProp = containers.Map({'spark.executor.cores'}, {'1'});
conf = matlab.compiler.mlspark.SparkConf('AppName','myApp', ...
                        'Master','local[1]','SparkProperties',sparkProp);
sc = matlab.compiler.mlspark.SparkContext(conf);

%% Collect
x = sc.parallelize({'A', 2, 'C'});
y = sc.parallelize({'D', 1});
z = x.cartesian(y);
out = z.collect()
Introduced in R2016b