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!