Changing a String in a loop for call external program command

조회 수: 1 (최근 30일)
Arman Kam
Arman Kam 2013년 5월 30일
I want to execute some other program and change the address of execution in every loop, i wrote the bottom piece of code but it doesn't work with giving me this error:
couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory couldn't read file "'Push';": no such file or directory
and the piece of code is:
clc;
clear all;
Zb=1500;
Zc=Zb*[0.75, 0.9, 1.0, 1.1, 1.2, 1.3, 1.5, 1.75, 2];
for ii=1:9
dlmwrite(['1\',num2str(ii),'\0\OpenSees\ColumnPar.tcl'], ['set Zc ',num2str(Zc(1,ii))],'delimiter','');
Push=['1\',num2str(ii),'\0\GoAll.tcl'];
!opensees 'Push';
end
I also tried system command but it didn't work!
(Note: opensees program is in the same folder of matlab file and GoAll.tcl is in another folder)

답변 (1개)

Eugene
Eugene 2013년 5월 30일
!opensees 'Push';
This will effectively look like
[]$ opensees 'Push';
in your linux/windows command line. So yes you do have to use system
>> system(sprintf('opensees %s', Push));
If this doesn't work then maybe there is something wrong with the path's that you've defined. Hope this helps.
  댓글 수: 1
Arman Kam
Arman Kam 2013년 5월 30일
Dear Eugene
opensees is a program that I want to call from system and run Push with it...

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

카테고리

Help CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by