Transform table to combine data

3 Ansichten (letzte 30 Tage)
Isabela Ramirez
Isabela Ramirez am 31 Jul. 2020
Beantwortet: Mohammad Sami am 31 Jul. 2020
Hello,
I would like to compare the information form this table using a heatmap. I previously wrote it this way:
cdata=T.NX
xvalues=T.GeneName
yvalues=T.TissueType
h=heatmap(xvalues,yvalues,cdata)
However, my x and y values both contain duplicate values so it cannot be plotted.
This is what my table T looks like
Gene GeneName TissueType NX
___________________ ________ _______________ _____
{'ENSG00000163347'} CLDN1 colon 7.2
{'ENSG00000134873'} CLDN10 colon 0.6
{'ENSG00000013297'} CLDN11 colon 3.4
{'ENSG00000163347'} CLDN1 duodenum 0.1
{'ENSG00000134873'} CLDN10 duodenum 1.4
{'ENSG00000013297'} CLDN11 duodenum 2.2
{'ENSG00000163347'} CLDN1 small intestine 0.4
{'ENSG00000134873'} CLDN10 small intestine 0.5
{'ENSG00000013297'} CLDN11 small intestine 2.6
I would like to modify the table to be:
CLDN1 CLDN10 CLDN11
colon 7.2 0.6 3.4
duodenum 0.1 1.4 2.2
small intestine 0.4 0.5 2.6
My original T table is 72x4 so recreating a table manually is not an option. How can I group my variables so that it can look this way?
Thanks
  1 Kommentar
Image Analyst
Image Analyst am 31 Jul. 2020
You forgot to attach your table T in a .mat file with the paper clip icon.
save('answers.mat', 'T');
Most people are probably waiting for that.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Mohammad Sami
Mohammad Sami am 31 Jul. 2020
You can use the function unstack to accomplish this. Read documentation for more details
if true
U = unstack(T,'NX','GeneName')
end

Weitere Antworten (0)

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by