Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You didn't tell us which platform you're on (Windows? Unix?). What does the system call return?

Some Ideas (since you cannot post code, we can try to guess your approach / chose a number next time ;-):

  1. system("....matlab someargs &"); --- get rid of the &
  2. system("nohup ....matlab someargs &"); --- get rid of nohup and &
  3. system("....matlab someargs"); --- check if matlab is a script that in turn starts a background process
  4. system("....matlab someargs"); --- something special about someargs?
  5. ...
Your Perl program could identify the MATLAB PID and wait (checking for the PID's existence periodically) until the process terminates before starting the next script.

Update:
Nothing to be sorry for. I'am not familiar enough with Windows and Matlab to give you any further suggestions... ok, maybe yet another: I found a tutorial that looks quite good. There, the batch mode is described (see section: Getting Started). There, the exit command is suggested to terminate batch-runs. So I assume, the batch mode has to be terminated explicitly. Maybe check your *.m files for any occurrences of exit that might terminate the script execution early and modify your command to matlab -sd Directory -r File1;File2;exit ... maybe that helps? You can even call Perl programs from Matlab (see here ; shell scripts also). So another workaround might be the creation of File3.m that just contains a perl() or system() call to start your 3rd script? Well, at least the true Matlab hackers have something to grin ;-)


In reply to Re: Calling External Program by Perlbotics
in thread Calling External Program by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-23 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found