I need to save the text entered into two edit boxes so that I can concatenate them with other strings to create the name of a desired file. Example code below:
function subject_editbox_Callback(hObject, eventdata, handles)
% hObject handle to subject_editbox (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
input=get(hObject,'String');
display(input)
sub=input;
function trial_editbox_Callback(hObject, eventdata, handles)
% hObject handle to trial_editbox (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
input = get(hObject,'String');
display(input)
trial = num2str(input);
% — Executes on button press in createfile.
function createfile_Callback(hObject, eventdata, handles)
% hObject handle to createfile (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Note: variables "displacement and "file_type" specified in individual button group SelectionChangeFcn callbacks
filed=strcat(sub,displacement);
filedesi=strcat(filed,trial);
filedesired=strcat(filedesi, file_type)
display(filedesired)
When I click on the pushbutton, it says:
"Undefined function or variable 'sub'.
Error in Vicon_GUI_Zeke>createfile_Callback (line 225) filed=strcat(sub,displacement);
Error in gui_mainfcn (line 95) feval(varargin{:});
Error in Vicon_GUI_Zeke (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Vicon_GUI_Zeke('createfile_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback"
Best Answer