MATLAB is a technical software environment that allows you to import, manipulate and analyse large amounts of data. In many cases, it your data will be highly dimensional, having three or more dimensions. Converting high-dimensional data to lower dimensions can allow your analysis to be easier and analysis algorithms to run more efficiently. MATLAB contains built-in function for altering the dimensionality of data.
- Skill level:
- Moderately Easy
Other People Are Reading
Import your data or create a test array. The following code creates a three-dimensional array of zeros in the form of repeated recordings from eight data channels. Each recording is 100 timepoints long and repeated 10 times.
my Data = zeros(100,10,8);
Convert the dimensionality of the array using the reshape function. To combine the 10 trials for each channel in the above example, use the following code:
myNewData = reshape(my Data,100*10,8);
This function would return a 1,000-by-eight array with the first two dimensions combined.
Remove singleton dimensions using the squeeze function. Although this is not always necessary, after manipulating your data you may be left with a dimension of length one, called a singleton dimension. The following code would remove singleton dimensions from an array.
better Array = squeeze(arrayWithSingletons);
Analyse your data further as appropriate.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for