how to pass an argument to python?

5 ビュー (過去 30 日間)
kanwal
kanwal 2014 年 10 月 28 日
回答済み: Michelle Hirsch 2014 年 10 月 28 日
I have a python script ,I am calling it from MATLAB using the following command;
system('python','abc',1) //abc is a my python file and 1 is the argument;
My question is how to pass an argument by reference ,suppose there is a count looping variable named 'x' and I want it to send to python executable file.Please help,this is my final year project ,and it's very urgent,plz help !

回答 (2 件)

Bjorn Gustavsson
Bjorn Gustavsson 2014 年 10 月 28 日
Why not use sprintf?
exce_str = sprintf('python %s if the first argument is a string %02d with a second integer ergument',string_variable,i1))
HTH

Michelle Hirsch
Michelle Hirsch 2014 年 10 月 28 日
If you have access to MATLAB R2014b, you could use the direct interface to Python. This interface supports passing data directly from MATLAB into Python functions.

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by