MATLAB Examples

Find the maximum value of a single variable in a data set using mapreduce. It demonstrates the simplest use of mapreduce since there is only one key and minimal computation.

Use the readtable function to import mixed data from a text file into a table. Then, it shows how to modify and analyze the data in the table.

Use mapreduce to carry out simple logistic regression using a single predictor. It demonstrates chaining multiple mapreduce calls to carry out an iterative algorithm. Since each

Compute the mean of a single variable in a data set using mapreduce. It demonstrates a simple use of mapreduce with one key, minimal computation, and an intermediate state (accumulating

Visualize patterns in a large data set without having to load all of the observations into memory simultaneously. It demonstrates how to compute lower volume summaries of the data that are

Compute the mean by group in a data set using mapreduce. It demonstrates how to do computations on subgroups of data.

Extract a subset of a large data set.

Compute the mean and covariance for several variables in a large data set using mapreduce. It then uses the covariance to perform several follow-up calculations that do not require another

Compute summary statistics organized by group using mapreduce. It demonstrates the use of an anonymous function to pass an extra grouping parameter to a parameterized map function. This

Compute a tall skinny QR (TSQR) factorization using mapreduce. It demonstrates how to chain mapreduce calls to perform multiple iterations of factorizations, and uses the info argument of

Use high-level MATLAB® functions to import the sample CDF file, example.cdf. High-level functions provide a simpler interface to accessing CDF files.

Use ImageDatastore and mapreduce to find images with maximum hue, saturation and brightness values in an image collection.

Use the findgroups and splitapply functions to calculate grouped statistics of a tall timetable containing power outage data. findgroups and splitapply enable you to break up tall

Create a datastore for key-value pair data in a MAT-file that is the output of mapreduce . Then, the example shows how to read all the data in the datastore and sort it. This example assumes that

Create text files, including combinations of numeric and character data and nonrectangular files, using the low-level fprintf function.

Use low-level functions to read data from a CDF file. The MATLAB® low-level CDF functions correspond to routines in the CDF C API library. To use the MATLAB CDF low-level functions

Create a datastore for a collection of images, read the image files, and find the images with the maximum average hue, saturation, and brightness (HSV). For a similar example on image

Import comma-separated numeric data from a text file, using the csvread function.

Create two different memory maps, and then read from each of the maps using the appropriate syntax. Then, it shows how to modify map properties and analyze your data.

Import mixed numeric and text data into separate arrays in MATLAB®, using the xlsread function.

To export a table in the workspace to a Microsoft® Excel® spreadsheet file, use the writetable function. You can export data from the workspace to any worksheet in the file, and to any location

Several different ways you can visualize tall arrays.

Fit data with a linear model containing nonpolynomial terms.

Use low-level functions to write data to a NetCDF file. The MATLAB® low-level functions provide access to the routines in the NetCDF C library. MATLAB groups the functions into a package,

Create a datastore for a large text file containing tabular data, and then read and process the data one chunk at a time or one file at a time.

Import mixed numeric and text data from a spreadsheet into a table. MATLAB® tables store both the data and relevant supporting information such as variable names or row names, all in a single

Access parts of variables from a MAT-file dynamically. This is useful when working with MAT-files whose variables names are not always known.

Export data to a CDF file using MATLAB® CDF low-level functions. The MATLAB functions correspond to routines in the CDF C API library.

Overwrite a portion of an existing binary file and append values to the file.

Perform simple linear regression using the accidents dataset. The example also shows you how to calculate the coefficient of determination R^2 to evaluate the regressions. The accidents

Write MATLAB® arrays to a Scientific Data Set in an HDF4 file.

Read data from a Scientific Data Set in an HDF4 file, using the functions in the matlat.io.hdf4.sd package. In HDF4 terminology, the numeric arrays stored in HDF4 files are called data sets.

Data smoothing refers to techniques for eliminating unwanted noise or behaviors in data, while outlier detection identifies data points that are significantly different from the rest of

Split data from the patients.mat data file into groups. Then it shows how to calculate mean weights and body mass indices, and variances in blood pressure readings, for the groups of

Append values to an existing text file, rewrite the entire file, and overwrite only a portion of the file.

Write and read complex numbers in binary files.

Remove a linear trend from daily closing stock prices to emphasize the price fluctuations about the overall increase. If the data does have a trend, detrending it forces its mean to zero and

Load, modify, and save part of a variable in an existing MAT-file using the matfile function.

Create a new NetCDF file that contains the variable, dimension, and group definitions of an existing file, but uses a different format.

Import numeric data delimited by any single character using the dlmread function.

Use histogram and histogram2 to analyze and visualize data contained in a tall array.

Export a cell array to a text file, using the fprintf function.

Extract date information from a CDF epoch object. CDF represents time differently than MATLAB®. CDF represents date and time as the number of milliseconds since 1-Jan-0000. This is called

Use multiple regression to model data that is a function of more than one predictior variable.

Export a table to a text file, using the writetable function.

Use the fwrite function to export a stream of binary data to a file.

Import all worksheets from an Excel® file. In this example, you gather information about the worksheets, import the worksheets into the workspace, and then analyze the imported data.

View the codec associated with a video file, using the mmfileinfo function.

Use the MATLAB® HDF5 low-level functions to write a data set to an HDF5 file and then read the data set from the file.

Get information about the dimensions, variables, and attributes in a NetCDF file using MATLAB low-level functions in the netcdf package. To use these functions effectively, you should be

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list:

See all countries