Main Content


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

Zip one RDD with another


result = zip(obj1,obj2)


result = zip(obj1,obj2) returns a key-value pair RDD result, where the first element in the pair is from obj1 and second element is from obj2. The output RDD result has the same number of elements as obj1. Both the obj1 and the obj2 must have the same length.

Input Arguments

expand all

An input RDD, specified as a RDD object.

An input RDD, specified as a RDD object.

Output Arguments

expand all

An output RDD zipped from two input RDDs, returned as a RDD object.


expand all

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

%% zip
x = sc.parallelize({'A', 'B', 3});
y = sc.parallelize({1, 2, 'C'});
out =; % {{'A',1},{'B',2},{3,'C'}}}
Introduced in R2016b