Best way to build a database-like variable?
古いコメントを表示
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
採用された回答
その他の回答 (1 件)
Artik Crazy
2011 年 10 月 19 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Language Support についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!