How can I call Cygwin command pipeline with the MATLAB 'system' function?
Afficher commentaires plus anciens
I installed Cygwin on my Windows machine and tried to use the MATLAB 'system' function to execute a pipeline of Linux commands provided by Cygwin. The execution failed, although the same command pipeline worked fine directly in the Cygwin shell. Below is the MATLAB code and the fourth line constructs the command pipeline to be passed to the 'system' function.
>> inputfname = 'input.gz'; % the sample input is attached
>> nlines = 5;
>> outprefix = 'out';
>> pipeline = sprintf('date; gzip -dc %s | sed -n ''2p;4~2p'' | split -a 3 -d -l %d --numeric-suffix=1 --additional-suffix=%s --filter=''gzip > $FILE.gz'' - %s ; date', inputfname, nlines,'_part.txt', outprefix);
>> system(pipeline);
The MATLAB console output said:
'sed' is not recognized as an internal or external command, operable program or batch file.
How can I make this work?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!