필터 지우기
필터 지우기

looping through total size and calculating standard deviation of each frame.

조회 수: 3 (최근 30일)
Ralph
Ralph 2020년 9월 12일
댓글: Ameer Hamza 2020년 9월 12일
I want my loop to run from 1 to length of x. x contain total 67000 frames and I want that my code loop through each frame at a time and calculate the standard deviation of each frame from 1 to length of x.
folder = fullfile('C:\Users\vvb\Documents\datset\local');
ADS = audioDatastore(folder);
x=read(ADS);
[row,c]=size(x);
for j=1:x
totalframes(j)=j;
local=totalframes;
stdX=std(local);
end
So basically 'x' contains total 67000 frames and I want to loop through each frame of 'x' and calculate the standard deviation of each frame. I have written the above code but its not working.

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 9월 12일
I don't have the audio toolbox, but something like this will work
folder = fullfile('C:\Users\vvb\Documents\datset\local');
ADS = audioDatastore(folder);
stdX = [];
while hasdata(ADS)
x = read(ADS);
stdX(end+1) = std(x);
end
  댓글 수: 2
Ralph
Ralph 2020년 9월 12일
This is not working I want my loop to run x number of times starting from 1 to length and store each value of x in a variable name local and than compute the standard deviation of each frame.
Ameer Hamza
Ameer Hamza 2020년 9월 12일
This code runs on all the frames in ADS. Is there any error? If you want to store all the signals too then try something like this
folder = fullfile('C:\Users\vvb\Documents\datset\local');
ADS = audioDatastore(folder);
x = {};
stdX = [];
while hasdata(ADS)
x{end+1} = read(ADS);
stdX(end+1) = std(x);
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Direction of Arrival Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by