Reading CSV as Structure Array
Ältere Kommentare anzeigen
Dear MATLAB Community,
I am attempting to transform a CSV into a MATLAB structure for input into another function. At present I have come up with:
expression = table2struct(readtable('sample_Expression.csv'))
expression =
136x1 struct array with fields:
gene
rawValue_1
rawValue_2
rawValue_3
rawValue_4
rawValue_5
value
However, I am more interested in creating something like this:
expression =
struct with fields:
gene: {136x1 cell}
rawValue: [136x5 double]
value: [136x1 double]
What is the difference in terms of using the two different structures? Could someone suggest a way to modify my present script to create something in the second example?
Thanks for any help!
2 Kommentare
Monika Jaskolka
am 26 Mai 2021
Can you attach your CSV file?
Jonathan Josephs-Spaulding
am 26 Mai 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Variables finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!