Attach first column with names to matrix with coordinates
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Panos Kerezoudis
am 12 Apr. 2023
Kommentiert: Jon
am 12 Apr. 2023
Hi!
I have a matrix ('positions') with 3 columns (x,y,z coordinates) and 200 rows (intracranial electodes).
I also have a character variable ('name') that contains an abbreviated name for each electrode. Is there a way to attach this column to the matrix, other than creating essentially a cell array? The goal is to ultimately export this matrix/dataset as an excel file (ie it will contain 4 columns and 200 row entries).
Thank you!
0 Kommentare
Akzeptierte Antwort
Jon
am 12 Apr. 2023
Bearbeitet: Jon
am 12 Apr. 2023
You can put the data into a table, and assign row names
For example
x = rand(5,1);
y=rand(5,1);
z=rand(5,1);
names = {'cat','dog','fish','mouse','bird'};
T = table(x,y,z,'RowNames',names)
Then to put the table into Excel
writetable(T,'mydata.xlsx','WriteRowNames',1)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!