Passing an array of strings into an executable

조회 수: 1 (최근 30일)
V Latorre
V Latorre 2020년 6월 16일
댓글: dpb 2020년 6월 16일
I have writen a script in Matlab for an optimization algorithm that iteratively calls a simulator to compute the objective function. The call to the simulator is done in such a fashion:
[status,cmdout]=system('swmm5 temp.inp out.rpt');
Where "temp.inp" is the text file with the parameters of the simulation and "out.rpt" is the text file with the results of the simulation.
I have an array of strings where the contents of "temp.inp" are updated and every iterations. Then I write this updated array of strings in "temp.inp" to launch a new simulation. Once the simulation is complete, I read "out.rpt", put it in an array of strings and extract the data I need.
Writing all of this content on the hard drive is quite time expensive, so I was wondering if there is a way to pass to the simulator the array of string directly and maybe put the "out.rpt" file directly in an array of strings.
  댓글 수: 1
dpb
dpb 2020년 6월 16일
That all depends on whether the simulation code has been written to read its input from the command line or not -- we can't answer that.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by