how can we create database with .mat files ?

22 次查看(过去 30 天)
hello
i have .mat files
its contain heart beat
i want to add it to database and then link it to matlab
how i can add these type of file to database ?
I've attached here one of them here
  4 个评论
Rahaf mutlaq
Rahaf mutlaq 2019-4-22
about your questions
Is it worth the trouble for you to transfer those matrices to an sql-database? (You don't want to store the mat-files themselfs in the database.)
the goal is to store .mat fies somewere , so we can search , view , insert , delete without them beaing in "current folder " matlab
Are you comfortable working with sql-databases?
yes not bad .. but storing .mat files its a new thng for me
What do you plan to do with this data? + Over how long a period of time?
it is a project , my teacher asked me to do
And finally, give some examples of requests that you want to make to the sql-database.
like I said search by name , insert new file , delete , view the content of the specified file
per isakson
per isakson 2019-4-23
编辑:per isakson 2019-4-23
Rahaf mutlaq, My questions are not relevant because I missed the context. Thank you for the answers.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2019-4-19
Yes, it is possible. It is, however, of low value to do so.
.mat files are just files, so they can be read in as arrays of uint8, and those arrays of uint8 can be stored as blobs in a database.
However, all you can do with those blobs is ask about things like the length of the blob, or retrieve the blob in case you wanted to do something like compress the blob as part of a corpus of tests on how well various compression routines do.
To go beyond that, to examine the contents of the .mat that you had stored, you would need information about the detailed binary structure of .mat files. That is documented for MAT5.0 format, but is not completely documented for MAT7.0 files. For MAT7.3 files, all that is documented is that it is a modified HDF5 format.
It is possible to retrieve a blob from the database, write it out to a temporary file, and then use the usual facilities such as load() to retrieve information from the temporary file that was saved from the blob. Many people would suggest that if you were going to do that, then you might as well just store the original files.
Some various recommendations on what you have to tell Microsoft Access in order to store BLOB:
  13 个评论
Walter Roberson
Walter Roberson 2019-4-22
You changed
chosen_file = fullnames{choice};
into
popumpmenu1_Callback = fullnames{choice };
which you should not have done: it should be left as chosen_file
Also, you should not set(handles.popupmenu1_Callback, etc), you should set(handles.popupmenu1, etc)
Note: for this code to execute, something will need to have set handles.popupmenu1 to the handle of a uicontrol style listbox or style popup.
For the callback to work, something will need to have set handles.popupmenu1 'Callback' property to invoke popmenu1_Callback passing in the current handles structure as the third parameter; also, handles.axes_for_plotting_data would have to have been set to an axes handle.
Furthermore, the reference to datastruct.NameOfVariableYouStoredDataInto needs to be adjusted to use the name of the variable that the data is stored in, inside your .mat file.
If you were to create a GUI using GUIDE, then the handles structure and callback property would be set up properly as long as you had given the listbox the tag 'popupmenu1' and you had created an axes that you gave the tag 'axes_for_plotting_data' to.
In practice, if you were to create a GUI using GUIDE, then the *_Callback functions would not terminate with an "end" statement like you have here. You need that "end" if you have that function inside a script, but in practice GUIDE GUIs generate code in function files, not in scripts.
Walter Roberson
Walter Roberson 2019-4-25
Value of a pop-up menu or listbox is the number of the entry that the user had selected. If the String property was a cell array of three character vectors, and the user selected the second of them, then the Value property would be set to 2. It is not the content of the string that was selected, but you can retrieve the String property and index that at the Value property to get the content of what was selected.
For readability I constructed the popup to have only the base filenames such as 's0010_rem', but for each of those, we need to know the complete filename with directory. You could mnake the complete file name part of what was displayed to the user, but that is generally a waste of space and harder to read. So instead we store the complete names in the UserData property of the uicontrol. The callback retrieves the Value (index number) and we use that to index into the list of complete file names we stored in the UserData property in order to find the complete name of the file to read.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by