I am creating a GUI using MATLAB's guide. I created a BROWSE button which asks the user to select a video file for analysis using the uigetfile function. The video file is then set to play in an axes within the GUI.
Now, I have another push button that shall be pressed to process the selected video. This process however requires the file path of the video file.
How can I extract the file path from the other previous button (BROWSE) so I may use it for the next push button (CARCOUNT)? THANK YOU!
HERE IS A SECTION OF MY CODE:
function browse_Callback(hObject, eventdata, handles)% hObject handle to browse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName,FilePath]=uigetfile('*.avi', 'Select a video');ExPath = [FilePath FileName]set(handles.file_path,'String',ExPath);guidata(hObject, handles);vid = VideoReader(ExPath);vidFrames = read(vid); %read in all video frames
numFrames = get(vid, 'numberOfFrames'); %get the number of frames from the video file
%Create a movie structure from the video frames initialized.
for k = 1 : numFrames mov(k).cdata = vidFrames(:,:,:,k); mov(k).colormap = [];end%Create a figure
hf = handles.vid_play_box;% Resize figure based on the video's width and height
set(hf);% Playback movie once at the video's frame rate
movie(hf, mov, 1);function initializeprocess_Callback(hObject, eventdata, handles)% hObject handle to carcount (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)filename = browse_Callback('ExPath');
Best Answer