Error converting Logical to Char (Horzcat Error)

afe = audioFeatureExtractor( ...
'SampleRate',fs, ...
'FFTLength',512, ...
'Window',hann(frameSamples,'periodic'), ...
'OverlapLength',frameSamples - hopSamples, ...
'barkSpectrum',true);
numBands = 50;
setExtractorParams(afe,'barkSpectrum','NumBands',numBands,'WindowNormalization',false);
In this line of code, I am receiving an error of converting logical to char (Horzcat error). How to solve this issue?

4 件のコメント

Rik
Rik 2021 年 4 月 20 日
What is the full trace of the error? (all the red text)
Try to make a MWE so we can run your code without any other dependencies and can reproduce your issue.
angry paul
angry paul 2021 年 4 月 20 日
編集済み: Rik 2021 年 4 月 20 日
In the section of compute audit spectra,I tried to reproduce the code.
Wrong use of horzcat
The following error occurred while converting from logical to char:
Unable to convert from logical to char.
Error audiofeatureextractor / setextractorparams (line 398)
if isscalar([varargin{:}])
Rik
Rik 2021 年 4 月 20 日
fs = 16e3; % Known sample rate of the data set.
segmentDuration = 1;
frameDuration = 0.025;
hopDuration = 0.010;
segmentSamples = round(segmentDuration*fs);
frameSamples = round(frameDuration*fs);
hopSamples = round(hopDuration*fs);
overlapSamples = frameSamples - hopSamples;
FFTLength = 512;
numBands = 50;
afe = audioFeatureExtractor( ...
'SampleRate',fs, ...
'FFTLength',FFTLength, ...
'Window',hann(frameSamples,'periodic'), ...
'OverlapLength',overlapSamples, ...
'barkSpectrum',true);
setExtractorParams(afe,'barkSpectrum','NumBands',numBands,'WindowNormalization',false);
disp('completed without error')
completed without error
Which release are you using?
angry paul
angry paul 2021 年 4 月 21 日
R2020a

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

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 4 月 20 日
編集済み: Walter Roberson 2021 年 4 月 20 日

0 投票

It is a bug in some versions of Audio System Toolbox. In later versions the line
if isscalar([varargin{:}])
has been replaced with
numin = numel(varargin);
if numin==1 && isscalar([varargin{:}])
I will post exact line numbers once I finish installing the old version to check against.
The problem was fixed by no later than R2020b

7 件のコメント

Walter Roberson
Walter Roberson 2021 年 4 月 20 日
編集済み: Walter Roberson 2021 年 4 月 21 日
R2020a, the code is in a single .m instead of an @ class directory.
In R2020a, and possibly some earlier versions, but not R2020b or later:
edit(fullfile(matlabroot, 'toolbox/audio/audio/audioFeatureExtractor.m'))
Look for lines 397 and 398
numin = numel(varargin);
if isscalar([varargin{:}])
Change that to
numin = numel(varargin);
if numin==1 && isscalar([varargin{:}])
and save.
You will need to have write access to the appropriate directory, which might require you to have started MATLAB with "Run As Administrator"
angry paul
angry paul 2021 年 4 月 21 日
sorry,I'm using the 2020a version,I took your approach, but there were new mistakes.
Misuse matlabshared.fusionutils.internal .setProperties>validateparameter (line 77)
Property / value is not valid for group parameter.
Error matlabshared.fusionutils.internal .setProperties (line 67)
validateparameter(param, obj);
Error audiofeatureextractor / setextractorparams (line 406)
params = matlabshared.fusionutils.internal .setProperties(defaults, numin, varargin{:});
Walter Roberson
Walter Roberson 2021 年 4 月 21 日
'WindowNormalization' is not a supported parameter in your release.
angry paul
angry paul 2021 年 4 月 21 日
Sir thank you so much for your help, I got my mistake.
Sharena Natasha Nor Hisham
Sharena Natasha Nor Hisham 2022 年 1 月 20 日
may i ask how you solved the issue about the 'windowNormalization' not a supported parameter? because im having the same problem
Walter Roberson
Walter Roberson 2022 年 1 月 20 日
R2020b was the first release to support WindowNormalization.
In R2020a and before, there is a 'Normalization' parameter that can be set to 'area' or 'bandwidth', but this is not the same thing.
In R2020b, 'Normalization' was renamed to 'FeatureBankNormalization', and 'WindowNormalization' was added.
I do not seem to find any information as to what WIndowNormalization actually does.
Sharena Natasha Nor Hisham
Sharena Natasha Nor Hisham 2022 年 1 月 21 日
ahh I see. Thank you so much for replying!

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

カテゴリ

ヘルプ センター および File ExchangePerformance and Memory についてさらに検索

タグ

質問済み:

2021 年 4 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by