Changing a String in a loop for call external program command

1 次查看(过去 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.

类别

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