Thread Subject: Matlab GUI pushbutton

Subject: Matlab GUI pushbutton

From: Eli Chmouni

Date: 9 Jul, 2009 16:29:02

Message: 1 of 5

Hello Everyone;
I have created a matlab gui that contains several features but the one i am stuck on is the load pushbutton. I have a push button that needs to accomplish the following task; ( when the push button is clicked i want a software on my computer to open). For more details the software is called FLIGHT GEAR (flightgear.org) it is a free flight simulator software. Thus when the user clicks that push button i want flight gear to open. Is that possible? If so what is the code that i need to use
Thank you so much

Subject: Matlab GUI pushbutton

From: Nathan

Date: 9 Jul, 2009 16:35:39

Message: 2 of 5

On Jul 9, 9:29 am, "Eli Chmouni" <echmo...@gmail.com> wrote:
> Hello Everyone;
> I have created a matlab gui that contains several features but the one i am stuck on is the load pushbutton. I have a push button that needs to accomplish the following task; ( when the push button is clicked i want a software on my computer to open). For more details the software is called FLIGHT GEAR (flightgear.org) it is a free flight simulator software. Thus when the user clicks that push button i want flight gear to open. Is that possible? If so what is the code that i need to use
> Thank you so much

Yeah.
I do the same thing to open ImageJ with matlab:

uiopen('C:\Program Files\ImageJ\ImageJ.exe',1)

If you're not sure where the file is going to be all the time, you can
also create a safety net that allows the user to search for the file
if it isn't in that specified directory. Here's an example of mine:

pathname = 'C:\';
initialdir = pwd;
if exist('C:\Program Files\ImageJ\ImageJ.exe','file')~=0;
    uiopen('C:\Program Files\ImageJ\ImageJ.exe',1)
else
    [filename, pathname] = uigetfile( ...
        {'*.exe', 'ImageJ Executable File (*.exe)'; ...
         '*.*', 'All Files (*.*)'}, ...
         'Select ImageJ Executable to be opened',pathname);
    if isequal([filename,pathname],[0,0]) % Handle "Cancel"
buttonpress
        cd(initialdir);
        return
    else
        uiopen(fullfile(pathname,filename),1);
    end
end

I hope this helps and works for you.
-Nathan

Subject: Matlab GUI pushbutton

From: Eli Chmouni

Date: 9 Jul, 2009 17:31:01

Message: 3 of 5

Hello Nathan
Thank you for the previous response but i am having some trouble applying it
i know where the file is located "C:\Program Files\FlightGear\bin\Win32\fgrun.exe"
but when i use uiopen it just opens another m file with weird symbols but it doesn not load the fllightgear software
Do you have any comments










Nathan <ngreco32@gmail.com> wrote in message <752b0202-e310-4a22-a3cc-bee9cf788a03@12g2000pri.googlegroups.com>...
> On Jul 9, 9:29?am, "Eli Chmouni" <echmo...@gmail.com> wrote:
> > Hello Everyone;
> > I have created a matlab gui that contains several features but the one i am stuck on is the load pushbutton. I have a push button that needs to accomplish the following task; ( when the push button is clicked i want a software on my computer to open). For more details the software is called FLIGHT GEAR (flightgear.org) it is a free flight simulator software. Thus when the user clicks that push button i want flight gear to open. Is that possible? If so what is the code that i need to use
> > Thank you so much
>
> Yeah.
> I do the same thing to open ImageJ with matlab:
>
> uiopen('C:\Program Files\ImageJ\ImageJ.exe',1)
>
> If you're not sure where the file is going to be all the time, you can
> also create a safety net that allows the user to search for the file
> if it isn't in that specified directory. Here's an example of mine:
>
> pathname = 'C:\';
> initialdir = pwd;
> if exist('C:\Program Files\ImageJ\ImageJ.exe','file')~=0;
> uiopen('C:\Program Files\ImageJ\ImageJ.exe',1)
> else
> [filename, pathname] = uigetfile( ...
> {'*.exe', 'ImageJ Executable File (*.exe)'; ...
> '*.*', 'All Files (*.*)'}, ...
> 'Select ImageJ Executable to be opened',pathname);
> if isequal([filename,pathname],[0,0]) % Handle "Cancel"
> buttonpress
> cd(initialdir);
> return
> else
> uiopen(fullfile(pathname,filename),1);
> end
> end
>
> I hope this helps and works for you.
> -Nathan

Subject: Matlab GUI pushbutton

From: Nathan

Date: 9 Jul, 2009 17:35:28

Message: 4 of 5

On Jul 9, 10:31 am, "Eli Chmouni" <echmo...@gmail.com> wrote:
> Hello Nathan
> Thank you for the previous response but i am having some trouble applying it
> i know where the file is located "C:\Program Files\FlightGear\bin\Win32\fgrun.exe"
> but when i use uiopen it just opens another m file with weird symbols but it doesn not load the fllightgear software
> Do you have any comments
>
> Nathan <ngrec...@gmail.com> wrote in message <752b0202-e310-4a22-a3cc-bee9cf788...@12g2000pri.googlegroups.com>...
> > On Jul 9, 9:29?am, "Eli Chmouni" <echmo...@gmail.com> wrote:
> > > Hello Everyone;
> > > I have created a matlab gui that contains several features but the one i am stuck on is the load pushbutton. I have a push button that needs to accomplish the following task; ( when the push button is clicked i want a software on my computer to open). For more details the software is called FLIGHT GEAR (flightgear.org) it is a free flight simulator software. Thus when the user clicks that push button i want flight gear to open. Is that possible? If so what is the code that i need to use
> > > Thank you so much
>
> > Yeah.
> > I do the same thing to open ImageJ with matlab:
>
> > uiopen('C:\Program Files\ImageJ\ImageJ.exe',1)
>
> > If you're not sure where the file is going to be all the time, you can
> > also create a safety net that allows the user to search for the file
> > if it isn't in that specified directory. Here's an example of mine:
>
> > pathname = 'C:\';
> > initialdir = pwd;
> > if exist('C:\Program Files\ImageJ\ImageJ.exe','file')~=0;
> >     uiopen('C:\Program Files\ImageJ\ImageJ.exe',1)
> > else
> >     [filename, pathname] = uigetfile( ...
> >         {'*.exe', 'ImageJ Executable File (*.exe)'; ...
> >          '*.*', 'All Files (*.*)'}, ...
> >          'Select ImageJ Executable to be opened',pathname);
> >     if isequal([filename,pathname],[0,0]) % Handle "Cancel"
> > buttonpress
> >         cd(initialdir);
> >         return
> >     else
> >         uiopen(fullfile(pathname,filename),1);
> >     end
> > end
>
> > I hope this helps and works for you.
> > -Nathan

If that one doesn't work, try:
system(full_file_name);

-Nathan

Subject: Matlab GUI pushbutton

From: Eli Chmouni

Date: 9 Jul, 2009 18:06:02

Message: 5 of 5

Yes Thank you Nathan that worked

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui Eli Chmouni 9 Jul, 2009 12:29:06
pushbutton Eli Chmouni 9 Jul, 2009 12:29:06
flightgear Eli Chmouni 9 Jul, 2009 12:29:06
rssFeed for this Thread

Contact us at files@mathworks.com