Changing a String in a loop for call external program command

2 views (last 30 days)
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)

Answers (1)

Eugene
Eugene on 30 May 2013
!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 Comment
Arman Kam
Arman Kam on 30 May 2013
Dear Eugene
opensees is a program that I want to call from system and run Push with it...

Sign in to comment.

Categories

Find more on Search Path in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!