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 日
It is trivial to save variables in a mat file, so it's not clear what difficulty you're facing.
To me it makes more sense to keep them together in the same file, but it's really a matter of preference. Whichever way you choose, you'll have to write the code to load them to match.
David Lee
David Lee 2019 年 4 月 1 日
What I mean is, let say I am having a total of 128 samples of data and for each sample, three different features have been extracted from each sample. So, I should save this three into one .mat file or separately? Same goes to whether saving all features from all samples together or need to be separated sample by sample?
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 日

0 投票

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 件)

質問済み:

2019 年 4 月 1 日

コメント済み:

2019 年 4 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by