Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Using MATLAB GUI?

I've zero knowledge in matlab

Using MATLAB GUI, how to create a dialog box to prompt user to enter numbers for calculation (simple calculation will do)?

10 points for complete working answer. I've zero knowledge in matlab

1 Answer

Relevance
  • Paine
    Lv 6
    1 decade ago
    Favorite Answer

    If you must use the full GUI. Type GUIDE from matlab prompt, create an OK prompt box, edit the mfile code add something like the following under the function

    pushbutton1_Callback(hObject, eventdata, handles).

    The following code would work independatly as a script etc. without the GUIDE matlab GUI programming environment.

    prompt={'Enter an integer:'};

    name='Input for pointless squaring an integer caculation';

    numlines=1;

    defaultanswer={'10'};

    answer=inputdlg(prompt, ...

    name,numlines,defaultanswer);

    output=str2num(answer{1}).^2;

    sprintf('%d',output)

    msgbox(['answer is ',num2str(output)])

Still have questions? Get your answers by asking now.