MATLAB is a technical software package for manipulating and modeling large quantities of scientific or engineering data. In most cases, these data are stored in large, multidimensional arrays or matrices. MATLAB contains a variety of methods to extract subsets of the multidimensional arrays containing your data so you can conduct specific analyses.
Construct your data array. This can be performed by importing your data for analysis. For an example, use the following code to generate a three-dimensional test array, composed of all zeros:
test_array = zeros(256,256,50);
In practice, this array could be a series of 50 256-by-256 images.
Select a single data point by addressing that specific index in the array:
my_data_point = test_array(128,128,10);
The above code will return a single value from the pixel in the center of the tenth image of the test array.
Select a list of data points by addressing the list in the appropriate dimension:
my_data_list = test_array([10 20 30],128,10);
The above code will return a 3x1 vector of the 10th, 20th and 30th value of the 128th line in the tenth image of the test array.
Select a range of data points by indexing the array using the start, increment and stop of the range each separated by a colon:
my_data_range = test_array(10:5:100,128,10);
The above code will return a 19x1 vector of the 10th, 15th, through the 100th values of the 128th line in the tenth image of the test array. Leaving the increment value off and only putting the start and stop value separated by a colon uses an increment of one.
Select an entire dimension by indexing using a colon operator:
my_data_line = test_array(:,128,10);
The above code will return a 256x1 vector containing the 128th line of the 10th image in the test array.