How to add my own data set?
2 views (last 30 days)
Show older comments
I'm planning to use this(MathWorks) for my research to prove my theory but I only have little knowledge in programming. Im planning to use my own data set but It gives me error.
function X = speechSpectrograms(ads,segmentDuration,frameDuration,hopDuration,numBands)
disp("Computing speech spectrograms...");
numHops = ceil((segmentDuration - frameDuration)/hopDuration);
numFiles = length(ads.Files);
X = zeros([numBands,numHops,1,numFiles],'single');
for i = 1:numFiles
[x,info] = read(ads);
fs = info.SampleRate;
frameLength = round(frameDuration*fs);
hopLength = round(hopDuration*fs);
spec = auditorySpectrogram(x,fs, ...
'WindowLength',frameLength, ...
'OverlapLength',frameLength - hopLength, ...
'NumBands',numBands, ...
'Range',[50,7000], ...
'WindowType','Hann', ...
'WarpType','Bark', ...
'SumExponent',2);
% If the spectrogram is less wide than numHops, then put spectrogram in
% the middle of X.
w = size(spec,2);
left = floor((numHops-w)/2)+1;
ind = left:left+w-1;
X(:,ind,1,i) = spec;
if mod(i,100) == 0
disp("Processed " + i + " files out of " + numFiles)
end
end
disp("...done");
end
Index in position 2 is invalid. Array indices must be positive integers or logical values.
Error in speechSpectrograms (line 38)
X(:,ind,1,i) = spec;
2 Comments
Guillaume
on 12 Dec 2018
"but It gives me error".
You have neither told us what you're doing exactly (code, please) nor what the error is (full text, please). How are we even supposed to know what the problem is?
Jan
on 12 Dec 2018
Please post the relevant information: Matlab does not produce an error message only because your are planning to do something. I guess, that you have written some code and get an error message. Then please edit the question to insert the code and the error message. It is much easier to help you to fix the problem, if you mention, what the problem is.
Answers (1)
Cris LaPierre
on 12 Dec 2018
For new users, it is best to have some type of formal introduction rather than trial and error. It would we a valuable investment of your time to go through the interactive getting-started tutorial MATLAB Onramp. It should only take a few hours, and will put you in a much better position to program in MATLAB.
0 Comments
See Also
Categories
Find more on Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!