Borrar filtros
Borrar filtros

Can read .sh file data?

6 visualizaciones (últimos 30 días)
min wong
min wong el 10 de Feb. de 2018
Respondida: Walter Roberson el 10 de Feb. de 2018
I want to ask a simple question,but I just can't solve it.
I have a test.sh file and a Untitled.m file.
How to use Untitled.m file read data from test.sh file?
What command should I use?
Thank you.

Respuestas (1)

Walter Roberson
Walter Roberson el 10 de Feb. de 2018
Do you mean that test.sh is a K-Shell script that is to be executed to produce output and that you want to read the output in Untitled.m ? If so then provided that you are using Mac or Linux, or you have installed the Linux subsystem on Windows 10 (not available for earlier Windows), then use
[status, result] = system('./test.sh');
and then result will be a character vector with embedded newlines which holds the output text; you can then use sscanf() or textscan() or regexp() or character operations to extract information from that character vector.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by