I try to write and read in parallel to/from a hardware device (under Linux) for the purpose of testing the device and it must happen infinitely until instructed to stop.
pattern=int16([ 0x0102, 0x0304, 0x0506, 0x0708;
0x090a, 0x0b0c, 0x0d0e, 0x0f10;
0x1112, 0x1314, 0x1516, 0x1718;
0x191a, 0x1b1c, 0x1d1e, 0x1f20]);
testdata=repmat(pattern, 1, 8192*repetition);
write_thread=parfeval(@writeXillybus, 2, write_file, testdata);
read_thread=parfeval(@readXillybus, 2, read_file, read_dim);
function out=writeXillybus(device, testdata)
test_fid=fopen(['/dev/xillybus_', device], 'w');
cleanup = onCleanup(@() fclose(test_fid));
function out=readXillybus(device, format)
data_fid=fopen(['/dev/xillybus_', device], 'r');
cleanup = onCleanup(@() fclose(data_fid));
out=fread(data_fid, format, '*int16');
However the workers crash with future reporting. 'Too many output arguments.' I have trouble making sense out of it, because it rises deep from Matlab internals: remote cause shows line 39 of toolbox/parallel/cluster/+parallel/+internal/+queue/evaluateRequest.m as origin.
Anyway, isn't parfeval supposed to be able to handle arbitrary number of outputs?