From 19782e6a997a98b34d7f9ac701709e10599fd801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clas=20Veib=C3=A4ck?= <clas.veiback@liu.se> Date: Wed, 23 Sep 2020 10:05:50 +0200 Subject: [PATCH] Added directory creation for out path and fixed a bug present in some Matlab versions. --- Code/Matlab/splitFile.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Code/Matlab/splitFile.m b/Code/Matlab/splitFile.m index 19e2ddf..9b792df 100644 --- a/Code/Matlab/splitFile.m +++ b/Code/Matlab/splitFile.m @@ -14,6 +14,8 @@ if nargin < 5 || isempty(show); show = true; end if nargin < 3 || isempty(inPath); inPath = 'E:\'; end if nargin < 2 || isempty(outPath); outPath = 'D:\Data\AudioRecorder\'; end + if ~exist(outPath); mkdir(outPath); end + inFilename = fullfile(inPath,[name '.wav']); outFilename = fullfile(outPath,[name '.wav']); outData = fullfile(outPath,[name '.bin']); @@ -31,7 +33,8 @@ if nargin < 5 || isempty(show); show = true; end fa = fopen(outFilename, 'w'); fd = fopen(outData, 'w'); - totalBytes = dir(inFilename).bytes; + fileInfo = dir(filename); + totalBytes = fileInfo.bytes; audioBytes = 0; dataBytes = 0; -- GitLab