Matlab Audio Format- How to process? - matlab

I have downloaded a EEG recording of a person in Matlab-Audio Format. I have no idea of how to use it in Matlab for further processing. Is it possible to generate signals in Matlab? If so, is there any code to generate EEG signal?
Any help would be highly appreciated. Thanks in advance!

Some versions of Winamp and Microsoft Access set the description for the .mat file extension to "MATLAB Audio Format", although I have no idea what this means. It's unclear to me if such a unique file type really exists; I'd love to know more if there is actually some special format of which I am not aware. More likely, the file you downloaded is simply a standard MATLAB .mat file containing the EEG data in one or more variables. You can read the variables in MATLAB with the load command. To see the variable names contained in the MAT file prior to loading it, use whos with the -file switch.

Related

data processing of the .mat result from Dymola simulation

I am trying to do data processing with the .mat result from Dymola. My plan is to use MATLAB. I got a few questions about the .mat file:
If I load the .mat file into MATLAB directly, the data structure is very strange, I have to use the MATLAB scripts shipped with Dymola to load the .mat file. Is there an explanation about how the data is stored in the .mat file?
when plotting the diagram with the result, I wanna change the unit, but I am not sure how to make Dymola output the data with the unit I want to use. Is there any setting that allows me to change the unit when Dymola output data into the .mat file?
Regarding the file format, note that there is a utility to convert the MAT files to a simple HDF5-based format, if that makes post-processing easier. There are scripts for both MATLAB and Python to read such files (extension SDF).
You can get an explanation for the basic data-structure of the result file if you generate a textual result file (it might also be somewhere in the documentation), and the most relevant part is:
Matrix with 4 columns defining the data of the signals:
dataInfo(i,1)= j: name i data is stored in matrix "data_j".
(1,1)=0, means that name(1) is used as abscissa
for ALL data matrices!
dataInfo(i,2)= k: name i data is stored in column abs(k) of matrix
data_j with sign(k) used as sign.
And to simplify things: there are at most two data-matrices, and the abscissa used for ALL data matrices is "Time".
You cannot currently directly output mat-files in specific units.
However, you can output csv-files using specific units.
The structure of the .mat files created by Modelica Dymola is introduced here briefly. But what you should know about this file format is that Dymola keeps the simulation variables in two different mat-file variables in this way:
The name and description for ALL of the variables are kept in two different separate variables inside the .mat file, i.e. name and description.
If a variable has a constant value and its value is not changed over time (like a scalar variable), it is kept inside data_1 variable inside the .mat file.
Otherwise, it is kept inside the data_2 variable inside the .mat file.
Keeping variable data like this is a technique used my Dymola to gain the best performance while saving simulation data in large files.
For reading these mat files created by Dymola without using Dymola itself, you can use a .mat reader library like MATIO to read the data and then interpret the results by your own.

How to save features into .mat file and .txt file using python in keras?

I would like to save my predicted features into .mat format and .txt format in keras for further process in Matlab. Please help me. Thanks.
For .mat, check out SciPy's File IO.
For .txt, there are many options, such as NumPy's savetxt.
Check out the CSV format as well, which is a common way to save data for cross-platform use.

Conversion from DICOM to YUV file

I have a series of DICOM files that I loaded on matlab. I would need to create a YUV file from the DICOM slices.Does anybody know how to do so?
Regards,
Note sure if this answers your question, but there is some code for this on the MATLAB file exchange:
http://www.mathworks.com/matlabcentral/fileexchange/11264-matlab-movie-to-yuv-file
I know this is for movies, but I think you will be able to use this code (maybe adapted) to run it for each slice separately, if that's what you want.

How to read MP3 in MATLAB

I am currently working on watermarking audio files in Matlab for a mathematics research project. So far I have been able to read wav files using wavread in Matlab. However, because wav files are very large, the resulting data is also large. Therefore, in order to simplify this I would like to know how I would be able to read an mp3 file in Matlab. So far I have only tried to read an mp3 by using dsp.AudioFileReader. However, the resulting data only contains 0's and a few other numbers, which is clearly not the correct data. Would someone please be able to help me? Thank you so much!
you can use this code:
hfr = dsp.AudioFileReader('yourfile.mp3');
hplay = dsp.AudioPlayer('SampleRate',sample_rate_here);
 while ~isDone(hfr)
         audio = step(hfr);
         step(hplay, audio);
end

How do you open .mat files in Octave?

I have a .mat file that I want to open and see its contents. Since I don't have MATLAB, I downloaded GNU's Octave. I'm working on Mac's terminal so I'm not exactly sure how to open the .mat file to see its contents.
How to do this?
Not sure which version of .mat file you might have, or whether Octave keeps up with the latest Matlab formats.
Here's a link that might be a good start.
Bottom line is that you can say: load MyMatFile.mat right at the Octave prompt.
In case you wind up having to write code to read the .mat file ever: I've done this before and it was not difficult, but was time-consuming. Mat file format for 2012a
If your file contains only numbers, no .mat header, then this should work:
variable = load("filename")