How do I plot my array on Imagesc?

10 vues (au cours des 30 derniers jours)
Emma Ponting
Emma Ponting le 7 Mar 2019
Commenté : Adam Danz le 8 Mar 2019
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 commentaires
Emma Ponting
Emma Ponting le 7 Mar 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 le 7 Mar 2019
eg.png
This is what I would get ideally

Connectez-vous pour commenter.

Réponses (2)

Adam Danz
Adam Danz le 7 Mar 2019
Modifié(e) : Adam Danz le 7 Mar 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 commentaire
Adam Danz
Adam Danz le 8 Mar 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.

Connectez-vous pour commenter.


Emma Ponting
Emma Ponting le 8 Mar 2019
When you say data do you just mean my 20x16x64 data set?

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by