Check empty & not empty of text box in GUI

3 views (last 30 days)
RJS
RJS on 9 Dec 2021
Answered: Voss on 9 Dec 2021
Notchop and Compop are the output textbox of GUI
op_n = str2double(get(handles.Notchop, 'String'));
op_c = str2double(get(handles.Compop, 'String'));
if ~empty(op_n)&& isempty(op_c) %op_n is not empty and op_c is empty
disp('H')
elseif isempty(op_n) && ~empty(op_c) %op_n is empty and op_c is not empty
disp('Gc')
elseif ~empty(op_n) && ~empty(op_c) %op_n is not empty and op_c is not empty
disp('H *Gc')
end
it showing error
Undefined function 'empty' for input arguments of type 'double'.
Error in GUI3_4>step_Callback (line 417)
if ~empty(op_n)&& isempty(op_c)
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GUI3_4 (line 42)
gui_mainfcn(gui_State, varargin{:});

Accepted Answer

Voss
Voss on 9 Dec 2021
replace empty with isempty

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!