Can I display a text from a textbox into the command window?

1 view (last 30 days)
Hi,
I have a gui with a textbox that is showing the frames of a movie while is playing. When i press pause, everything pauses. Is there any way to copy or print the 'Current frame' showed in the text box while the movie is in pause??

Answers (1)

Jason Whitfield
Jason Whitfield on 19 Jul 2018
If you have a handle to the textbox, you can access its text through its "String" property. You can get a handle to it with the "findobj" or "findall" functions. For example, if there is only one textbox in the image, you could do the following.
textbox = findall(gcf, 'Type', 'textboxshape');
disp(textbox.String);
  1 Comment
Galit Moshkovitz
Galit Moshkovitz on 23 Jul 2018
Hi Mr.Whitfield,
thanks for your answer.
But is not working. Maybe I did not explain well.
I have a gui with a text, which is changing when the video is playing because is showing the frame numbers. I want to display the current frame number when I pause the video on the gui.
I tried your answer but did not work or maybe I put it in the wrong place.
Here is a screenshot of the gui and a part of my code.
if true
% code
end
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
videoObject = handles.videoObject;
set(handles.pushbutton4,'Enable','on');
set(handles.pushbutton3,'Enable','off');
axes(handles.axes3);
for frameCount = 2:videoObject.NumberOfFrames
% Display frames
set(handles.text3,'String',num2str(frameCount));
frame = read(videoObject,frameCount);
imshow(frame);
drawnow;
end
set(handles.pushbutton5,'Enable','on');
set(handles.pushbutton4,'Enable','off');
%----PAUSE/PLAY---
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if(strcmp(get(handles.pushbutton4,'String'),'Pause'))
set(handles.pushbutton4,'String','Play')
uiwait();
else
set(handles.pushbutton4,'String','Pause');
uiresume();
end
I also have tried to put global variables, but I am a little new to Matlab.

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!