Is is possible to redirect the output of a system command that calls another program?

4 Ansichten (letzte 30 Tage)
Essentially, I am calling the system command to run Vivado Lab in order to program an FPGA over JTAG. So
status = system('vivado_lab prog.tcl')
is the command I run. The output of this writes to the Command Window of uncompiled code and to the Console of compiled code. Part of this output is a progress bar. Is it possible to make this output to a text area, a different function, or somehow get the output while the command is still running?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Feb. 2025
HDL Coder does not appear to be supported on Mac.
On Linux:
Redirect output (possibly stderr) to a named pipe. Read from the named pipe within MATLAB.
On Windows:
Instead of using system(), use the .NET facility System.Diagnostics.Process . See for example https://www.mathworks.com/matlabcentral/answers/2002092-system-diagnostics-process-doesn-t-execute-all-commands-in-external-file#answer_1280947 but you would RedirectStandardOutput instead of RedirectStandardInput (or possibly RedirectStandardError). You would stdout.ReadLine to get at the output line by line.
  2 Kommentare
Eamon
Eamon am 10 Feb. 2025
I am not using HDL Coder, I am just using the system command to run Vivado Lab that then flashes an already created bitstream. At no point does MATLAB directly touch the HDL code, that's a separate project entirely. This project is to test the device and ensure it has the latest SW and FW installed, and install it if it doesn't. However, this looks to be what I would need to do. I will try it out when I am able to, thank you.
Walter Roberson
Walter Roberson am 10 Feb. 2025
Well, if you are somehow running Vivado on your Mac (perhaps you have Parallels installed to run other binaries through emulation, as Vivado binaries for Mac are not available), then you can use the named pipe approach on your Mac.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by