%% Read Data with Specified Spacing Between Variable Indices
% Read and plot data, where the data is sampled at a specified spacing between variable indices along each dimension. Start reading from the location in startLoc and read variable data at intervals specified in stride. A value of 1 in stride, accesses adjacent values in the corresponding dimension. Whereas, a value of 2 accesses every other value in the corresponding dimension, and so on.

startLoc = [1 1]; 
count  = [10 15]; 
stride = [2 3]; 
sampledPeaksData  = ncread('example.nc','peaks',startLoc,count,stride);
whos sampledPeaksData

% Plot the data.

surf(double(sampledPeaksData));
title('Peaks Data Subsampled by [2 3]');

% Copyright 2018 The MathWorks, Inc.