Borrar filtros
Borrar filtros

how to load his code

3 visualizaciones (últimos 30 días)
sam aldoss
sam aldoss el 7 de Oct. de 2018
Comentada: sam aldoss el 13 de Oct. de 2018
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 comentarios
Stephen23
Stephen23 el 7 de Oct. de 2018
Editada: Stephen23 el 7 de Oct. de 2018
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 el 13 de Oct. de 2018
size(current_folder) where I should post this am not an expert in matlab

Iniciar sesión para comentar.

Respuestas (1)

Stephen23
Stephen23 el 7 de Oct. de 2018
Editada: Stephen23 el 7 de Oct. de 2018
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:

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by