The edit field must have a mathematical equation alert using MATLAB GUIDE
Show older comments
I want to add a validation to the first edit field shown in the following interface:

So, if the user enters something rather than a mathematical equation, an error message must appear to the user.
How can I do such a validation, what shall I be writing exactly in the edit field call back function to do that?
function editEquation_Callback(hObject, eventdata, handles)
% hObject handle to editEquation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editEquation as text
% str2double(get(hObject,'String')) returns contents of editEquation as a double
if ()
errordlg('Enter a valid mathematical equation', 'Error', 'modal');
else
%do nothing
end
Accepted Answer
More Answers (0)
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!