MATLAB Answers

why i am getting error while using editable text in guide?

5 views (last 30 days)
AJAY R on 12 Jun 2020
Commented: AJAY R on 16 Jun 2020
Error using uicontrol
Too many input arguments.
Error in msgbox (line 253)
OKHandle=uicontrol(figureHandle , ...
Error in errordlg (line 59)
handle = msgbox(ErrorStringCell,dlgName,'error',replace);
Error in guidefunc>showErrorDialog (line 3955)
h = errordlg(e.getReport(), getDialogTitle());
Error in guidefunc (line 165)
showErrorDialog(me ,'Unhandled internal error in guidefunc');
com.mathworks.jmi.MatlabException: Too many input arguments.
at com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.sendMatlabMessage(
at com.mathworks.jmi.MatlabLooper.sendMatlabMessage(
at com.mathworks.jmi.Matlab.mtFevalConsoleOutput(
at com.mathworks.jmi.MatlabWorker.feval(
at com.mathworks.jmi.MatlabWorker.feval(
at com.mathworks.jmi.MatlabWorker$


Geoff Hayes
Geoff Hayes on 12 Jun 2020
Ajay - without seeing all of your code it will be challenging to understand what is going wrong. Have you perhaps, in your GUI, created a variable named ucontrol or perhaps you've created your own function named uocontrol? The error message is telling you that too many input parameters are being passed into uicontrol (at the line where it is trying to create the OK button).
At the command line, try typing
which uicontrol -all
What is returned from this command? Also, again at the command line, try to create a simple message box as
msgbox('error message', 'Hello', 'error')
Does this work? If not, what is the full error message.
Also, what is the report in the following line of code? A string or a cell array of strings?
h = errordlg(e.getReport(), getDialogTitle());
AJAY R on 15 Jun 2020
function varargout = raj(varargin)
% RAJ MATLAB code for raj.fig
% RAJ, by itself, creates a new RAJ or raises the existing
% singleton*.
% H = RAJ returns the handle to a new RAJ or the handle to
% the existing singleton*.
% RAJ('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in RAJ.M with the given input arguments.
% RAJ('Property','Value',...) creates a new RAJ or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before raj_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to raj_OpeningFcn via varargin.
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
% Edit the above text to modify the response to help raj
% Last Modified by GUIDE v2.5 15-Jun-2020 19:51:29
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @raj_OpeningFcn, ...
'gui_OutputFcn', @raj_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
gui_mainfcn(gui_State, varargin{:});
% End initialization code - DO NOT EDIT
% --- Executes just before raj is made visible.
function raj_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to raj (see VARARGIN)
% Choose default command line output for raj
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes raj wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = raj_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
GEOFF HAYES the below one are the results for your code
Adam Danz
Adam Danz on 15 Jun 2020
"Error using uicontrol"
I don't a reference to uicontrol anywhere in the code you shared.
Is msgbox() the name of a file or are you using Matlab's builtin function msgbox()?

Sign in to comment.

Accepted Answer

Geoff Hayes
Geoff Hayes on 15 Jun 2020
Ajay - look closely at the results from which uicontrol --all:
built-in ...... % shadowed
So you have written your own (?) uicontrol function that is shadowing the built-in one. Please remove the file C:\Users\ajayr\Documents\MATLAB\uicontrol.m and try running your code again. (You will probably want to restart MATLAB after removing the file.)

More Answers (0)

Translated by