How to load the .m file on clicking the button in the GUI

  • Thread starter renuka1011
  • Start date
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
 

Want to reply to this thread?

"How to load the .m file on clicking the button in the GUI" You must log in or register to reply here.

Related Threads for: How to load the .m file on clicking the button in the GUI

Replies
0
Views
2K
Replies
0
Views
8K
  • Posted
Replies
0
Views
2K
Replies
0
Views
8K
Replies
0
Views
6K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top