필터 지우기
필터 지우기

how to load his code

조회 수: 3 (최근 30일)
sam aldoss
sam aldoss 2018년 10월 7일
댓글: sam aldoss 2018년 10월 13일
hello everyone, am working on some sound analysis on wav files which I have loaded into matlab and I run all other process but it show an under line where I have marked at the end and it show this massage can some one help please
%load audio file in to matlab
training_fds = fileDatastore(fullfile(pwd,'training'), 'ReadFcn', @importAudioFile, 'FileExtensions', '.wav', 'IncludeSubfolders', 1);
data_dir = fullfile(pwd, 'training');
folder_list = dir([data_dir filesep 'training*']);
for ifolder = 1:length(folder_list)
disp(['Processing files from folder: ' folder_list(ifolder).name])
current_folder = [data_dir filesep folder_list(ifolder).name];
reference_table = table();
% Import ground truth labels (1, -1) from reference. 1 = Normal, -1 = Abnormal
*_reference_table_* = [reference_table; importReferencefile([current_folder filesep 'REFERENCE.csv'])];
end
Consider preallocating a variable or array before entering the loop by using zeros, ones, cell, or a similar function. Preallocating avoids the need for MATLAB to copy the data from one array to another inside the loop. For examples of code that do and do not preallocate an array, see “Preallocating Arrays”.
  댓글 수: 3
Stephen23
Stephen23 2018년 10월 7일
편집: Stephen23 2018년 10월 7일
Why do you create a datastore object training_fds, but never use it?
Note that you call reference_table = table(); within the loop, so this will overwrite any existing reference_table from any previous loop iterations. Basically your loop does nothing as it discards all imported data, except for from the last iteration.
Tip: do not create filepaths using string concatenation. Use fullfile.
sam aldoss
sam aldoss 2018년 10월 13일
size(current_folder) where I should post this am not an expert in matlab

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

답변 (1개)

Stephen23
Stephen23 2018년 10월 7일
편집: Stephen23 2018년 10월 7일
Try something like this:
S = dir(fullfile('.','training*'));
N = {S([S.isdir]).name};
C = cell(1,numel(N));
for k = 1:numel(N)
F = fullfile('.',N{k},'REFERENCE.csv');
C{k} = importReferencefile(F);
end
All of the data will be in the cell array C. This is based on the examples in the MATLAB documentation:

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by