Main Content


Class: matlab.compiler.mlspark.RDD
Namespace: matlab.compiler.mlspark

Return a new RDD by applying a function to each element of an input RDD


result = map(obj,func,varargin)


result = map(obj,func,varargin) returns a new RDD result by first applying a function func to all elements of obj. varargin represents a variable-length input argument list for the inputs to the function being applied.

Input Arguments

expand all

An input RDD, specified as a RDD object.

Function to be applied to each element in the input RDD, specified as a function handle.

Data Types: function_handle

A variable-length input argument list, specifying inputs to the function that is being applied.

Output Arguments

expand all

A pipelined RDD containing mapped elements of the input RDD, 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);

%% map
inputRDD = sc.parallelize({'A','B','C','A','B'},2);

Version History

Introduced in R2016b