Passing Parameters to perl from Matlab

조회 수: 5 (최근 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에서 Dialog Boxes에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by