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

6 ビュー (過去 30 日間)
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?

採用された回答

Walter Roberson
Walter Roberson 2025 年 2 月 10 日
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 件のコメント
Eamon
Eamon 2025 年 2 月 10 日
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 2025 年 2 月 10 日
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.

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by