Passing Parameters to perl from Matlab
2 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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 件のコメント
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 Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!