Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Dec 29, 2011 #1
    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
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: How to load the .m file on clicking the button in the GUI
Loading...