How do I plot my array on Imagesc?

Hi,
I have an array that is a 16x20x64 double which I want to represent using imagesc to show the distribution of the data across different electrodes on the scalp (the data is from an EEG signal). The X-axis of the image should be the frequency, which ranges from 0-40Hz in 2Hz bins, and the Y-axis should be the electrode number, which ranges from 1-16.
Not sure if this is helpful but this is how I reshaped the data from it's original from, so that it reflects the frequency range and the electrodes:
newarray = reshape(ec_psd_2hz,16,20,64)
So I should end up with a colour map with 320 pixels.
Any help would be amazing as I'm pretty sure the image I am getting is incorrect, I didn't really understand what was on the imagesc documentation page so it didn't really help.

4 comentarios

Adam Danz
Adam Danz el 7 de Mzo. de 2019
The first and second dimensions are sampling rate and electrode number. What's the 3rd dimension represent? Time? If so, are you trying to display the grid of data at a single point in time?
Adam
Adam el 7 de Mzo. de 2019
imagesc will display 2d data. You have 3d data so you need to either scalar index into the 3rd dimension or reshape your data into 2d if you want to show all the information at once, though this would result in an unwrapped 3d image as 2d which is not usually very useful for interpretation.
Emma Ponting
Emma Ponting el 7 de Mzo. de 2019
The third dimension is the number of arrays of data I have, not a third dimension.
When I look at the raw data it is 64 matrices that are all 16x20
Emma Ponting
Emma Ponting el 7 de Mzo. de 2019
eg.png
This is what I would get ideally

Iniciar sesión para comentar.

Respuestas (2)

Adam Danz
Adam Danz el 7 de Mzo. de 2019
Editada: Adam Danz el 7 de Mzo. de 2019
The examples in Matlab's documentation should be useful to follow.
For your data, this should get you started.
x = 0: 2: 40; %hz
y = 1 : 16; %elect num
data %your matrix that is size [16, 20]
imagesc(x,y,data') % note that 'data' is transposed to size [20,16]

1 comentario

Adam Danz
Adam Danz el 8 de Mzo. de 2019
"When you say data do you just mean my 20x16x64 data set?"
In your comments under the question, you mentioned, "When I look at the raw data it is 64 matrices that are all 16x20". "Data" in my solution refers to one of these 16 x 20 matricies.

Iniciar sesión para comentar.

Emma Ponting
Emma Ponting el 8 de Mzo. de 2019

0 votos

When you say data do you just mean my 20x16x64 data set?

Categorías

Preguntada:

el 7 de Mzo. de 2019

Comentada:

el 8 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by