PDA

View Full Version : how to load the .m file on clicking the button in the GUI


renuka1011
Dec29-11, 09:01 AM
Hi...

Me too new to this concept. I too want to load a .m file by pressing the button in the GUI.

I am the beginner to matlab. I have added 3 buttons to my gui and if i click on the first button means then i want the .m file stored in the same directory be loaded and automatically that .m file will begin its execution. I dont know how to load the .m file on clicking the button in my gui window.Please help me.

and the code that i have used is

[FileName,PathName] = uigetfile('*.m','Select the file');
if FileName==0, return, end

Struct1 = load( fullfile(PathName,FileName) );
Structname = fieldnames(Struct1);

but the .m file is not loaded i have error in this code..

plese help me