What is the best format and way to organize a database ?

2 次查看(过去 30 天)
Hi everyone,
I've been working for a while on an app in app designer, that allows me to transform data and export the results (either as reports or .mat files or pages in the original excel files). I've been learning to code by myself and I do a lot of things that are not recommanded, like dynamic variable naming. And I'm trying to quit.. but it's hard !
I've been reading extensively on different solutions in the documentation or the forum, but i'm still having a hard time. Here is my specific issue.
Each subject gets several acquisitions that constitute several tables (about 3000*90 each) ; each subject also has individual characteristics (gender, age, mass...).
I'm looking for a new way to store all of this data, especially since i wanna work on an intuitive way to compare the data (acquisitions compared for one subject, several subjects compared to one another, or even comparison of groups of subjects based on similar characteristics (like m/f)) :
  • either in one comprehensible file that can be easily managed (maybe with fields?).
  • or maybe in an individual file per subject that would contain the individual characteristics, as well as each acquisitions.
  • or something else..?
So far with my humble knowledge I went for the second solution, but it's not working inside the app. Here's what i tried :
saveDATA=['.\data\',app.ref.Value,'.mat'];
saveMAT="DATA_" + app.SUJET_date.Value + "_" + app.examnb.Value + "_EYESOPEN";
assignin('calling',saveMAT,EYESOPEN); % also tried with 'base', no success
save(saveDATA,saveMAT,'-append');
The assignin seems not to be working (although it does work when i try the same trick in the MatLab command window).
I'm willing to learn and do better with another solution, but i'm having a hard time finding some relevant documentation for what i'm trying to do, so anything will help really.
Thanks in advance for your time and help !
  1 个评论
Dave B
Dave B 2020-11-4
Thibault -
  • Maybe you could expand on what you mean by "it's not working" - what are you expecting to happen? Do you get an error? Does the file not get saved?
  • I'm wondering why you're doing the assignin part, it looks like your goal is to save some variable to a mat file, but you should be able to do that all from within your app...why does the caller need to be involved?
  • The documentation for assignin appears to want the first argument to read 'caller' not 'calling'
  • I think you're probably better off with one file, a likely deciding factor here relates to how big the data are (i.e. how long it takes to read/write them, and can you keep them all in memory at once).
  • A few thoughts on some useful concepts: table is a handy datatype for the characteristics, it'll let you store heterogenous data (e.g. numbers, strings, etc.) with names for each characteristic (column), and a row for each subject. If you think of row number as being an index, not everything has to be in the same variable as long as the index matches. For (super simple) example, ind=tabledata.age > 40; bar(measurements(ind)); would make a bar graph for each value of measurements where the corresponding age was over 40....as long as there is one 'measurement' for each row in tabledata.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by