MATLAB: How to fix this error

guidematlab gui

Hi, I had facing this problem. I try to compute the GUI and it comes out this error.

Best Answer

fm is not a simple one line edit text box like you thought. In guide, you had two lines for it, so the get() call returns a cell array instead of a character array. Here, get your values in the run callback like below. I'm also attaching a fixed version of your program.
% Get the contents of the edit fields.
editFieldContents = handles.fm.String;
if isempty(editFieldContents)
warningMessage = sprintf('fm is empty. Please enter a value for it');
uiwait(warndlg(warningMessage));
return;
end
val1 = str2double(editFieldContents);
editFieldContents = handles.fc.String;
if isempty(editFieldContents)
warningMessage = sprintf('fc is empty. Please enter a value for it');
uiwait(warndlg(warningMessage));
return;
end
val2 = str2double(editFieldContents);
editFieldContents = handles.EM.String;
if isempty(editFieldContents)
warningMessage = sprintf('EM is empty. Please enter a value for it');
uiwait(warndlg(warningMessage));
return;
end
val3 = str2double(editFieldContents);
editFieldContents = handles.EC.String;
if isempty(editFieldContents)
warningMessage = sprintf('EC is empty. Please enter a value for it');
uiwait(warndlg(warningMessage));
return;
end
val4 = str2double(editFieldContents);
editFieldContents = handles.RESIS.String;
if isempty(editFieldContents)
warningMessage = sprintf('RESISTANCE is empty. Please enter a value for it');
uiwait(warndlg(warningMessage));
return;
end
val5 = str2double(editFieldContents);