Best way to build a database-like variable?
Mostrar comentarios más antiguos
Hi all,
I need to set up a sort of database (within a variable) in Matlab. It needs to have column titles at the top, and 2 cells of strings at the beginning of each row. I better visualize it:
Example:
'fid' 'fname' 'beats' 'param1' 'param2' '...' 'param66'
'B10A130' 'A130.xls' 239 3.3462 6.3002 ... 1.0063
'B10A131' 'A131.xls' 302 4.2465 6.4051 ... 0.9354
'B10A132' 'A132.xls' 287 5.6232 5.9402 ... 0.8531
Data will be entered one value at a time, in a loop, so not one line at a time. This file will be filled with data over a longer period of time, so it will be saved and loaded a number of times.
What is the best variable to choose? I think a cell, right? Or a structure of some kind?
The data needs to be extracted too, but a column at a time, so when I would need all beats, I should want to enter:
x = database(2:end, 3)
Would that work with a cell type? I tried it on a test-cell but I had to use {} and I got a bunch of seperate ANS, instead of one array of numbers.
So what do you guys reckon, what would be best for me to set up this project? I'm using MATLAB 2010b
Thanks in advance,
Sven
Respuesta aceptada
Más respuestas (1)
Artik Crazy
el 19 de Oct. de 2011
0 votos
Hi, I find a dataset array to be quite useful in such tasks. It can be used as matrix and as a structure in the same time, and has a join function, that is particularly useful function in a "database like" constructions. This array is part of Statistical Toolbox.
Categorías
Más información sobre Language Support en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!