mirtoolbox print every feature mirfeatures in matlab

Assuming you have already loaded a miraudio object and extracted the features using mirfeatures function of the mirtoolbox, you can print every feature separately using the following code:

main.m
% Load an audio file using miraudio function
audio = miraudio('audiofile.wav');

% Extract all available features using mirfeatures function and store the results in a mirfeatures object
features = mirfeatures(audio);

% Get a list of all feature names available in the extracted features object
feature_names = fieldnames(features{1});

% Loop through the feature names list and print each feature value
for i=1:length(feature_names)
    fprintf('%s = %f\n', feature_names{i}, features{1}.(feature_names{i}))
end
514 chars
14 lines

Please note that the above code will print only the first (in this case, the only) segment from the extracted features object, assuming you didn't specify any segmentation options when calling the mirfeatures function. If you have multiple segments, you need to loop through the features object as well.

Also, some feature values might be arrays or matrices with multiple dimensions, in which case you might need to use additional loops to print their contents.

related categories

gistlibby LogSnag