Executing command in Cygwin through matlab causes only 2 of 3 files to be generated
I'm trying to convert some data from physionet.org. I have batch downloaded a bunch of .dat files which I need converted to .mat files. Physionet.org provides a toolbox for doing this (even for MATLAB). I just can't get the MATLAB toolbox/function to work. This caused me to install cygwin and compile their libraries and do it this way with running loops in matlab and converting them one after one.
I'm using the function wfdb2mat like this: wfdb2mat -r s0010_re > s0010_rem.info. This should produce three files: .hea, .mat and .info. The last file .info isn't produced when running it through matlab, but running the command manually it works.
The code below is what I'm using:
theprogram = '"C:\cygwin64\bin\bash.exe"'; thearguments = ['-l -i -c ''cd ''/cygdrive/c/users/xxx/' filename ''';' 'wfdb2mat -r ' s ' > ' s 'm' '.info'] system(sprintf('%s %s', theprogram, thearguments))
The sprintf outputs this: "C:\cygwin64\bin\bash.exe" -l -i -c 'cd '/cygdrive/c/users/xxx/patient001';wfdb2mat -r s0010_re > s0010_rem.info"
If I copy it directly over in a shortcut to bash.exe it works outputting all three files. The only difference I notice is these two messages when MATLAB opens bash:
bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell
Update I found out that MATLAB crates the output file (.info) in the MATLAB wd - so by moving that file to the intended folder the problem was solved. I tried adding the absolute path to the command line, that didn't work for me though.
I hope someone can help! Thanks in advance, Sonny
I found out that MATLAB crates the output file (.info) in the MATLAB wd - so by moving that file to the intended folder the problem was solved using the movefile command. I tried adding the absolute path to the command line, that didn't work for me though.