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

    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
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

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

Similar Threads for load file clicking
Mathematica FeynArts model file
MATLAB User Specifying a Fit Function in a Separate File