Cannot run a batch for function and script
6 次查看(过去 30 天)
显示 更早的评论
Hi, I am using the vad.m function (script here: function []=vad(finwav, fpitch, fvad, vadThres, foutwav )
and a script of my own to define the files (audiofiles) in finwav. This is the script (essaivad5.m):
clear all
close all
clc
sourceDir = ('F:\normalized\normalizedcut');
files = dir([sourceDir, '*.wav']);
fileNames = {files.name};
nbFiles = length(fileNames);
if (nbFiles == 0)
display(['Warning: found no wav files in... ', sourceDir])
end
fs = 48000;
vadThres = 0.1;
for iFile = 1:nbFiles;
finwav = audioread([sourceDir,fileNames{iFile}]);
end
display('... done')
So in order to run it and get the VAD(finwav), I thought I would need a batch script. It looks like that, but it doesn't work as I get a 'to many output arguments' error: j = batch (vad, essaivad5); wait(j); diary(j) load(j)
Any advice on how I should proceed?
0 个评论
回答(1 个)
Edric Ellis
2016-8-10
If you want to run a batch job, you need to specify a function handle and then the number of output arguments, and then the input arguments in a cell array. So, the equivalent of calling the serial code
out = VAD(finwav);
is to run a batch job:
j = batch(@VAD, 1, {finwav});
wait(j);
outCell = fetchOutputs(j);
out = outCell{1};
It's not quite clear to me where in your script you were trying to call VAD...
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!