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 CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by