Toby Howison
Toby Howison

Reputation: 3

how to open a file from a GUI?

How can I open a script in editor from a GUI push button callback?

I've tried:

function load_Callback(hObject, eventdata, handles)

uiopen(myfile.m)

But it doesn't work!

Cheers,

Toby

Upvotes: 0

Views: 559

Answers (2)

Scott
Scott

Reputation: 383

First you need to use the function open Then you need to enquote the name of the file in the parameters like :

    open('myfile.m') %this will open the exact file 'myfile.m'

This will open the file in the editor.

You can use uiopen to let the user chose the file.

    uiopen() %this will prompt the user to choose file

I suggest you take a look here:

http://www.mathworks.com/help/matlab/ref/open.html http://www.mathworks.com/help/matlab/ref/uiopen.html

Upvotes: 1

Shai
Shai

Reputation: 114786

If you want to open file.m in editor you need to use edit command

edit file.m 

Upvotes: 1

Related Questions