batch_convert_EDF

batch_convert_EDF(input_spec, target_rate, varargin)

BATCH_CONVERT_EDF Resample-and-rewrite a batch of EDF files in parallel.

result = batch_convert_EDF(input_spec, target_rate, …)

Inputs:
input_specone of
  • cell array of file paths

  • directory string (uses ‘Pattern’ to glob)

  • text file path with one filename per line

target_rate : target sample rate (Hz) for all signals

Name-value pairs:

‘OutputDir’ : ‘’ (default: alongside each input file) ‘CompressMode’ : ‘zstd’ (default) | ‘gzip’ | ‘none’ ‘Compress’ : (deprecated) true -> ‘zstd’, false -> ‘none’.

‘CompressMode’ takes precedence if both are passed.

‘GzipLevel’ : integer 1..9 (default 6) ‘ZstdLevel’ : integer 1..22 (default 9) ‘Parallel’ : true (default if a parpool exists). When true and no

pool exists, attempts to start one; falls back to serial on failure.

‘WorkerThreads’: integer >= 1 (default 1). BLAS / computational

threads per parpool worker. Default 1 prevents the N_workers x N_cores oversubscription that otherwise tanks resample’s FIR filter performance under parfor on multi-core boxes. Increase only if your workload is not BLAS-heavy and you have spare cores. Ignored when ‘Parallel’ is false.

‘StageLocal’false (default). When true, each file is first

copied to a local scratch directory, converted there, then the output is moved to its final location. Use this when inputs/outputs live on NFS / shared storage where concurrent reads from many parfor workers would contend at the file server. Disk space required per worker = one input file + one output file at a time.

‘StageDir’‘’ (default: system temp dir from tempname).

Only used when ‘StageLocal’ is true.

‘Pattern’ : ‘*.edf’ (default; matches .edf, .edf.gz, .edf.zst) ‘Verbose’ : false (default) ‘AutoScale’ : ‘recompute’ (default) | ‘preserve’. See convert_EDF

for the rationale on why ‘recompute’ is the default.

Output:
resulttable with columns

input : char (full path) output : char (full path) or ‘’ on failure status : ‘ok’ or ‘failed’ elapsed_s : double (seconds, NaN on early failure) error_message : char (’’ on success)

Per-file errors are caught and recorded; the batch always completes for the remaining files.

See also: convert_EDF, read_EDF, write_EDF.