I am trying to get the GUI display a numerical value for salary, but I keep getting the error code
Matrix dimensions must agree.
Error in sblife>pushforsalary1_Callback (line 330)
if Career == 'Athlete'
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in sblife (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)sblife('pushforsalary1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
The code runs just fine when I just have one career as a possiblity, but once I add the second I get that error. Here is my code right now. Thank you in advance!
function pushforsalary1_Callback(hObject, eventdata, handles)Career=get(handles.careerbox1,'String');if Career == 'Athlete' listofsalaries = [20000 50000 60000 70000 90000]; salopt=randi(5); handles.salarybox1.String = listofsalaries(salopt);elseif Career == 'Entertainer' listofsalaries = [20000 50000 30000 40000 80000]; salopt=randi(5); handles.salarybox1.String = listofsalaries(salopt);end
Best Answer