MATLAB: Input Dialog error :(

dialoginputinputdlgMATLAB and Simulink Student Suite

Hi all 🙂
I'm trying to get user input for note values so i eventually can play any note in an octave. Although yesterday it was working fine, for some reason my code to take user input keeps erroring with:
Attempt to execute SCRIPT dialog as a function:
C:\Users\Paul\Documents\MATLAB\dialog.m
Error in inputdlg (line 123)
InputFig=dialog( ...
Error in dialog (line 8)
answer=inputdlg(prompt,name,[1 50],defaultans);
Here's my code for it and although i'm new to matlab, i cannot for the life of me see any differences or errors in the code from what i found on this site:
% SHOW INPUT DIALOG AND TAKE USER INPUT..
prompt={'1st Note','2nd Note','3rd Note','4th Note','5th Note','6th Note','7th Note'};
name='Enter Note Values (C, D, etc)..';
num_lines=1;
defaultans={'C','D','E','F','G','A','B'};
answer=inputdlg(prompt,name,[1 50],defaultans);
% CONFIGURE INPUT TO VARIABLES..
Note1 = answer{1};
Note2 = answer{2};
Note3 = answer{3};
Note4 = answer{4};
Note5 = answer{5};
Note6 = answer{6};
Note7 = answer{7};
Any ideas why its erroring out on me? Yesterday with the same code, it displayed the dialog box but today, the error 🙁
Thanks,
Paul

Best Answer

You created your own script file named dialog.m, located in the directory C:\Users\Paul\Documents\MATLAB. When the inputdlg function included in MATLAB attempts to call the dialog function included in MATLAB your script named dialog takes precedence (because "C:\Users\Paul\Documents\MATLAB" is your current directory, I assume?) and so inputdlg attempts to call your script as a function. That's why you receive an error.
The solution is for you to rename your dialog.m script file.