Extracted Features in .MAT files

4 ビュー (過去 30 日間)
David Lee
David Lee 2019 年 4 月 1 日
コメント済み: Guillaume 2019 年 4 月 1 日
Hi.
I want to save the extracted features after signal processing to feed into classifier. For example, I have mean, standard deviation and one other coefficient as extracted features. How can I save them in .mat files? I should save it together or independently?
Thank you.
  4 件のコメント
Guillaume
Guillaume 2019 年 4 月 1 日
編集済み: Guillaume 2019 年 4 月 1 日
I am having a total of 128 samples of data and for each sample, three different features have been extracted from each sample
Presumably, you end up with just one variable, an array of 128 arrays of 3 features. So you would just save that in a mat file. If you end up with 128 different variables, then you've gone wrong, and we need to fix that part of your code.
David Lee
David Lee 2019 年 4 月 1 日
I see. The three features are Mean, Standard Deviation and a correlation coefficient. As you said a mat file that consists of 128 arrays of 3 features, how do I save it? The 3 features will be obtained from one sample at one time only. I need to run my code 128 times for 128 samples to get respective features. How can I save it into one mat files? Any codes to share? save function like can't be used,

サインインしてコメントする。

採用された回答

Guillaume
Guillaume 2019 年 4 月 1 日
It's hard to give you proper code without knowing the exact code you're using. It would go something like this:
samplesignals = {???}; %No idea what you're starting with. Here I am assuming a cell array of signals
featurevectors = cell(size(samplesignals)); %could also use a 2d matrix instead of a cell array
for sampleidx = 1:numel(samplesignals) % iterate over the signals
featurevectors{sampleidx} = yourfeaturefunction(samplesignals{sampleidx});
end
save('somefile.mat', 'featurevectors');
  2 件のコメント
David Lee
David Lee 2019 年 4 月 1 日
Basically, I want to save the extracted features to something like this. Capture.PNG
Guillaume
Guillaume 2019 年 4 月 1 日
Well, it'd be more or less the same code. Again, rough outline since you haven't given specifics.
Here I'm storing your feature vectors in a 128x3 matrix, which I then convert into a table.
samplesignals = {???}; %No idea what you're starting with. Here I am assuming a cell array of signals
numfeatures = 3;
featurevectors = zeros(numel(samplesginals), numfeatures);
for sampleidx = 1:numel(samplesignals) % iterate over the signals
featurevectors(sampleidx, :) = yourfeaturefunction(samplesignals{sampleidx}); %assuming it returns a 3 element vector
end
featurevectors = array2table(featurevectors, 'VariableNames', {'mean', 'std', 'corrcoeff'});
save('somefile.mat', 'featurevectors');

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAntennas, Microphones, and Sonar Transducers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by