Headers in Matlab
Ältere Kommentare anzeigen
Hello, my problem is the following one. I have data say of the following kind:
Iter X Y Z
1 30 40 50
2 50 60 70
3 30 70 80
I want to be able to store the data in different columns by invoking the headers. To explain it better, if the variable "data" contains all the information, then when I say data['Iter'] I should be able to obtain the column [1,2,3]. I have learnt this from python and I want to know if this is possible using Matlab.
Chiara
Akzeptierte Antwort
Weitere Antworten (3)
Matt Tearle
am 21 Mär. 2011
3 Stimmen
The syntax isn't exactly what you've specified, but you can refer to columns by name, similar to structures. You can read data from file (including column headers) directly with dataset.
Walter Roberson
am 20 Mär. 2011
0 Stimmen
You will not be able to do what you want with that syntax. You would be able to use data('iter'), if you went through a long exercise of programming a new data class. Or you could go for the Database Toolbox.
Andrew Newell
am 20 Mär. 2011
data.Iter = [1; 2; 3];
data.X = [30; 50; 30];
data.Y = [50 60 70];
data.Z = [50 80 80];
data.Iter
ans =
1
2
3
Kategorien
Mehr zu Structures 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!