Cannot run a batch for function and script

6 ビュー (過去 30 日間)
Cy
Cy 2016 年 8 月 9 日
回答済み: Edric Ellis 2016 年 8 月 10 日
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?

回答 (1 件)

Edric Ellis
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...

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by