Name and label dimensions of an array?

5 views (last 30 days)
Hilmar Lehnert
Hilmar Lehnert on 2 Feb 2014
Edited: David Pate on 28 Jan 2021
Simple example: I have a set of transfer function measurements for different angle and different loudspeakers in the box. So that's 3-dimensional data array with the dimensions being frequency, angle and driver number. I would like to be able to name the dimensions "frequency", "angle" and "driver" and associate scales with them. So the scale frequency would be [0 5 10 .. ] Hz, angle would be [0 30 60 ...] degrees and driver could be either numbers or labels {'woofer', 'tweeter'}
This could be used to access the data so instead of x = fx(23,37,2); Syntax could be x = get(fx,'frequency',1000,'angle',30,'driver','woofer'); Or even x = frequency{1000}.angle{30}.driver{'woofer'}'
I can certainly write a class like this myself but that seems such a basic functionality that I hope someone has already written something like this.

Answers (1)

Walter Roberson
Walter Roberson on 2 Feb 2014
Use a table()
  2 Comments
Hilmar Lehnert
Hilmar Lehnert on 2 Feb 2014
I don't think table() would work. A table is still inherently 2-dimensional jsut with different data tyeps along the row dimensions. I want just a regular data array (of N dimensions) with the ability to name each dimension and associate a scale are axis with each dimension.
David Pate
David Pate on 28 Jan 2021
Edited: David Pate on 28 Jan 2021
I second the OP's request. Due to Matlab's natural use of array arithmetic and vectorized operatorions (see vectorization), it is common to extend arrays into higher dimensions. The variable name can indicate what object is being represented by the array, but it would nice to also have metadata to reveal the order of the dimensions (i.e., to name the dimensions).

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!