Cannot run a batch for function and script
Show older comments
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?
Answers (1)
Edric Ellis
on 10 Aug 2016
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...
Categories
Find more on Audio and Video Data 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!