How to run an external program

edited July 2009 in Science & Tech
I want to use matlab to run an external program, and let the external program open a .dat file. When I use the command "!canny.exe my.dat", it just open the canny program but does not run the my.dat file. What's wrong?

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    i don't know what canny is, but you may need to give it the full path to my.dat c:\blahblah\blah\my.dat or try the system command

    help system

    will tell you how to use it.
  • ButtersButters CA Icrontian
    edited July 2009
    Are you on Vista? Admin? etc..
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    this is matlab, it shouldn't matter.
  • edited July 2009
    The system is windows XP.
    the dat file is just in the current directory of matlab, so does the Canny.exe program. The command just opened the program, but failed to let the program open the dat file.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    did you try either of the 2 things i suggested?
  • edited July 2009
    I've tried them.
    The first: !CANNY.exe c:\sample.dat
    does not work. just open the Canny.exe program.
    The second: system('CANNY.exe')
    Sample_MS1.DAT
    It displays "Undefined variable "Sample_MS1" or class "Sample_MS1.DAT"
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    you'd want system('canny.exe sample_ms1.dat')
  • edited July 2009
    Thank you again.
    I just tried the 'system('canny.exe sample_ms1.dat')' command.
    The program was opened but did not open the dat file.
    I'm almost exhausted.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    since i don't know what canny is, i can't help you troubleshoot. the problem is with canny not loading your data file, not with matlab calling it. do you have to pass canny a flag to make it load the data file?
  • edited July 2009
    Yes , the program 'Canny' should open or load the dat file, so as to run the analysis described in the dat file.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    does it work if you run it from a command prompt??
  • edited July 2009
    If I open the program Canny.exe and select the 'open' from its 'file' menu to open the dat file, It works well.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    unless the canny.exe file knows what to do with a command line option, it's not going to work to call it from matlab.
  • edited July 2009
    The normal way for the Canny.exe program to do this kind of analysis is to open one dat file from its 'file' menu.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited July 2009
    I know. What I'm saying is that unless whoever wrote the canny program designed it to be called with a data file as the first argument, it won't know that it's supposed to load it.
  • edited July 2009
    Maybe. Thank you for your suggestions!
Sign In or Register to comment.