Passing Parameters to perl from Matlab

2 ビュー (過去 30 日間)
Sunu
Sunu 2013 年 1 月 4 日
hey I need to pass the name of the config fie with a list of output signals from the model to a perl script. when I do perl('editXML.pl','Bcar_ExternalBypass.ehcfg','VeBCAR_e_OffBrdHVChrgVehStat',' VeBCAR_U_OnBrdChrgrVltCmnd')...I get the script to work properly. but the list and config file name('Bcar_ExternalBypass.ehcfg') has to be determined dynamically.
I tried this a=''; and a=[a list] , where list mutiplies perl('editXML.pl','Bcar_ExternalBypass.ehcfg',a) treats the entire list as a single name. I thought that spaces between the signals will treat it as new arguments into the perl script.
Any help is appreciated.

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 1 月 4 日
Just an example of filling in the file name dynamically
configname = sprintf('Bcar_pass%05d.ehcfg', ThisPass);
perl('editXML.pl', configname, 'VeBCAR_e_OffBrdHVChrgVehStat', 'VeBCAR_U_OnBrdChrgrVltCmnd')
  2 件のコメント
Sunu
Sunu 2013 年 1 月 7 日
I also wanted the list ('VeBCAR_e_OffBrdHVChrgVehStat', 'VeBCAR_U_OnBrdChrgrVltCmnd', a3, a4)to be transferred dynamically. This list is the output signals from the model which changes as I change the model
Walter Roberson
Walter Roberson 2013 年 1 月 7 日
So pass the values you want in those positions. There is nothing magic about the perl() call: you can pass variables instead of literal strings.
You do need to have written your perl script to take into account the strings it finds on the command line. perl is not going to recognize numeric values or cell array of strings, only plan strings, so if you are trying to pass a list of values for an argument, you need to figure out how you are going to have the perl script recognize when you have reached the end of any particular argument list.

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

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by