Home Warning when passing arguments to a GUIDE GUI
 I am trying to pass arguments to a GUIDE generated GUI. This works but throws a Warning. inputTest('Passed In String')  Warning: The input to STR2FUNC "Passed In String" is not a valid function name. This will generate an error in a future release. I know I have passed arguments to GUIDE GUIs in the past and I don't recall ever seeing this warning message before. However, I am relatively new to Matlab 2016b so something may have changed that I am not aware of. I didn't find anything in the documentation. The warning occurs in the "initialization code - DO NOT EDIT" auto generated section and only happens when passing in an optional argument. Is this a bug in 2016b or have I missed something? Minimal Example below. It is a simple GUI with only a single Edit box. function varargout = inputTest(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @inputTest_OpeningFcn, ... 'gui_OutputFcn', @inputTest_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); % WARNING OCCURS HERE end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT function inputTest_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; % Fill the box if the string is passed in. if nargin == 4 handles.edit1.String = varargin{1}; else handles.edit1.String = 'Nothing Passed In'; end guidata(hObject, handles); function varargout = inputTest_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output; function edit1_Callback(hObject, eventdata, handles) function edit1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end