Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
GUI - save and load buttons

Subject: GUI - save and load buttons

From: Chris

Date: 9 Dec, 2008 19:36:02

Message: 1 of 1

I watched a video by Doug Hull on using a save and load button in a GUI to remember settings, and this could be quite useful in a project I am taking. I thought it would be best to apply it to a small GUI I wrote to learn the principles behind GUI operations and I have got slightly stuck. Unfortunately, the file I downloaded from the top example on this page:
throws up an error on line 42 which I don't understand.

I've taken the relevant snippets out that should illustrate where I am at without filling up this page too much! I can post the whole m file if necessary - is there a way to attach files to this thread?

function gui1
fig=figure('name','My GUI','position',[360 500 160 140],'menubar','none');

    'position',[20 110 30 5],...
    'position',[20 10 40 15],...
    'position',[80 10 40 15],...

 function savebutton(source,eventdata);
    function loadbutton(source,eventdata);
    function savestate(m1);
        state.m1=get(m1, 'value');
        save fig.mat state
    function restorestate(m1);
        load 'fig.mat', 'state';
        set(m1, 'value', state.m1);

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us