how to use segmentSignals() in Deep learning
Show older comments
Hello
I want to use a deep learning Example in matlab, which is in beloew link:
In the example, function segmentSignals() is not existing. I have tried with matlab 2020a and tried it online in which both sends me an error that this funcrion is not defined.
would you please provide me the fucntion?
Best Regards
Amin
5 Comments
Asiya Al-Busaidi
on 16 Jun 2021
I am getting the same error.
Did you manage to resolve this issue?
호준 임
on 3 Jul 2021
Im pass this functinon but it works !
Fan Peng
on 26 Oct 2021
function [signalsOut, labelsOut] = segmentSignals(signalsIn,labelsIn)
%SEGMENTSIGNALS makes all signals in the input array 9000 samples long
% Copyright 2017 The MathWorks, Inc.
targetLength = 9000;
signalsOut = {};
labelsOut = {};
for idx = 1:numel(signalsIn)
x = signalsIn{idx};
y = labelsIn(idx);
% Ensure column vector
x = x(:);
% Compute the number of targetLength-sample chunks in the signal
numSigs = floor(length(x)/targetLength);
if numSigs == 0
continue;
end
% Truncate to a multiple of targetLength
x = x(1:numSigs*targetLength);
% Create a matrix with as many columns as targetLength signals
M = reshape(x,targetLength,numSigs);
% Repeat the label numSigs times
y = repmat(y,[numSigs,1]);
% Vertically concatenate into cell arrays
signalsOut = [signalsOut; mat2cell(M.',ones(numSigs,1))]; %#ok<AGROW>
labelsOut = [labelsOut; cellstr(y)]; %#ok<AGROW>
end
labelsOut = categorical(labelsOut);
end
Aisha
on 2 Nov 2022
any body solve this prblem please???????
Answers (0)
Categories
Find more on Startup and Shutdown 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!