I want to check if my edit-text fields in my GUI are blank, before checking if these values are valid for a given piece of equipment.
My code is:
function CheckValuesButton_Callback(hObject, eventdata, handles)
if handles.NominalWeightRadio == 1
NW = (handles.NominalWeightEdit);
if isempty(NW)
errordlg('Add Nominal Weight.','Error')
return
end
end
BOPType = char(handles.BOPTypeBox);
RamDesign = char(handles.RamDesignBox);
ID = (handles.InsideDiameterEdit);
if isempty(ID)
errordlg('Add Inside Diameter.','Error')
return
end
OD = (handles.OutsideDiameterEdit);
if isempty(OD)
errordlg('Add Outside Diameter.','Error')
return
end
[MaxWall, MaxDiam] = getMaxDims(BOPType,RamDesign);
handles.errorDims = checkDims(MaxWall, MaxDiam, ID, OD);
guidata(hObject,handles)
The problem is that even though I have not touched the edit-text boxes, they are not empty, i.e., my code continues to run, and crashes in checkDims when there are no numerical values for ID and OD. When I print the handles i get:
handles =
OutsideDiameterEdit: [1x1 UIControl]
InsideDiameterEdit: [1x1 UIControl]
PipeDescriptionEdit: [1x1 UIControl]
NominalWeightEdit: 15
Where I have inserted info for the NominalWeightEdit text box.
How can I get these to be empty, instead of [1x1 UIControl].
Thanks
Joakim