How to Execute a Powershell (*.ps1) script from matlab

Does anyone know how to run a ps1 script from matlab and also pass variable created from my matlab code into the powershell script?
MATLAB R2013b Powershell for Windows 7
My powershell script: uart.ps1 creates a message in bytes opens COM4 (this is my usb-uart port connected to my FPGA) sends data to the usb-uart tries to read from the usb-uart writes the data read from the usb-uart to a file on my PC
My Matlab code: data_extractor.m takes in a binary file extracts the bytes performs some calculations format the bytes into 10 separate packets or messages call powershell to send these packets to the usb-uart to the FPGA

2 件のコメント

Nathalie Cauchi
Nathalie Cauchi 2016 年 1 月 29 日
Maybe it is a bit too late (just found this as am trying to pass parameters to ps1 myself). To run a ps1 script from Matlab use the following command:
!powershell -inputformat none -file myfile.ps1
Walter Roberson
Walter Roberson 2016 年 1 月 29 日
Equivalently,
system('powershell -inputformat none -file myfile.ps1')

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Acquisition Toolbox Supported Hardware についてさらに検索

質問済み:

2014 年 7 月 22 日

コメント済み:

2016 年 1 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by