이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
popupmenu and pushbutton work
조회 수: 1 (최근 30일)
이전 댓글 표시
Pan
2012년 8월 14일
hi, if the figure has two uicontrol,"popupmenu and pushbutton.
The popupmenu has four kinds ,"watch","phone","book","can".
there are four kinds videos.
I hope that
step1, choose the play video
step2, push pushbutton for play vidoe.
I don't how to contiune popupmenu and pushbutton.
could you help me ,thanks.
댓글 수: 5
Matt Fig
2012년 8월 14일
Pan, when you post code, please remember these steps:
- Paste the code.
- Highlight the code only.
- Press the button that looks like this: {} Code.
Thanks.
Pan
2012년 8월 14일
편집: Pan
2012년 8월 15일
function f4()
clear all;
obj1 = mmreader('keybook.avi');
obj2 = mmreader('keywatch.avi');
obj3 = mmreader('keycan.avi');
obj4 = mmreader('keyphone.avi');
obj5 = mmreader('keyglasses.avi');
vid1 = read(obj1);
vid2 = read(obj2);
vid3 = read(obj3);
vid4 = read(obj4);
vid5 = read(obj5);
frame1 = 1;
frame2 = 1;
frame3 = 1;
frame4 = 1;
frame5 = 1;
f4 = 1;
stopwhile=1;
hst1=0;
hst2=0;
hst3=0;
hst4=0;
hst5=0;
h4 = figure('Name','four', 'NumberTitle','off','Color',[1,1,1],'Toolbar','none','Visible','on', 'Position',[10 40 1350 700],...
'Resize','off','menu','none');
hpop1 = uicontrol('unit','pixel','style','popupmenu','position',[33,600,80,50],'string','book|watch|can|phone|glasses','value',1,'callback',{@pop1_callback});%'UserData',vid1,vid2
hstat1 = uicontrol('unit','pixel','style','checkbox','value',0,'Visible','off','position',...
[33 445 25 25],'units','normalized');
hstat2 = uicontrol('unit','pixel','style','checkbox','value',0,'Visible','off','position',...
[653 445 25 25],'units','normalized');
hstat3 = uicontrol('unit','pixel','style','checkbox','value',0,'Visible','off','position',...
[33 95 25 25],'units','normalized');
hstat4 = uicontrol('unit','pixel','style','checkbox','value',0,'Visible','off','position',...
[653 95 25 25],'units','normalized');
hstat5 = uicontrol('unit','pixel','style','checkbox','value',0,'Visible','off','position',...
[583 95 25 25],'units','normalized');
hplay1 = uicontrol('unit','pixel','style','pushbutton','string','book-play',...
'position',[33 445 70 40],'backgroundColor',[0.3,0.8,1],'units','normalized','callback',{@play1_callback});
hplay2 = uicontrol('unit','pixel','style','pushbutton','string','watch-play',...
'position',[653 445 70 40],'backgroundColor',[0.3,0.8,1],'units','normalized','callback',{@play2_callback});
hplay3 = uicontrol('unit','pixel','style','pushbutton','string','can-play',...
'position',[33 95 70 40],'backgroundColor',[0.3,0.8,1],'units','normalized','callback',{@play3_callback});
hplay4 = uicontrol('unit','pixel','style','pushbutton','string','phone-play',...
'position',[653 95 70 40],'backgroundColor',[0.3,0.8,1],'units','normalized','callback',{@play4_callback});
hplay5 = uicontrol('unit','pixel','style','pushbutton','string','glasses-play',...
'position',[583 95 70 40],'backgroundColor',[0.3,0.8,1],'units','normalized','callback',{@play5_callback});
hstop1 = uicontrol('unit','pixel','style','pushbutton','string','book-stop',...
'position',[33 405 70 40],'backgroundColor',[0.2,1,0],'units','normalized','callback',@stop1_callback);
hstop2 = uicontrol('unit','pixel','style','pushbutton','string','watch-stop',...
'position',[653 405 70 40],'backgroundColor',[0.2,1,0],'units','normalized','callback',@stop2_callback);
hstop3 = uicontrol('unit','pixel','style','pushbutton','string','can-stop',...
'position',[33 55 70 40],'backgroundColor',[0.2,1,0],'units','normalized','callback',@stop3_callback);
hstop4 = uicontrol('unit','pixel','style','pushbutton','string','phone-stop',...
'position',[653 55 70 40],'backgroundColor',[0.2,1,0],'units','normalized','callback',@stop4_callback);
hstop5 = uicontrol('unit','pixel','style','pushbutton','string','glasses-stop',...
'position',[583 55 70 40],'backgroundColor',[0.2,1,0],'units','normalized','callback',@stop5_callback);
hori1 = uicontrol('unit','pixel','style','pushbutton','string','book-ori',...
'position',[33 365 70 40],'backgroundColor',[1,0.1,0.5],'units','normalized','callback',@ori1_callback);
hori2 = uicontrol('unit','pixel','style','pushbutton','string','watch-ori',...
'position',[653 365 70 40],'backgroundColor',[1,0.1,0.5],'units','normalized','callback',@ori2_callback);
hori3 = uicontrol('unit','pixel','style','pushbutton','string','can-ori',...
'position',[33 15 70 40],'backgroundColor',[1,0.1,0.50],'units','normalized','callback',@ori3_callback);
hori4 = uicontrol('unit','pixel','style','pushbutton','string','phone-ori',...
'position',[653 15 70 40],'backgroundColor',[1,0.1,0.5],'units','normalized','callback',@ori4_callback);
hori5 = uicontrol('unit','pixel','style','pushbutton','string','glasses-ori',...
'position',[583 15 70 40],'backgroundColor',[1,0.1,0.5],'units','normalized','callback',@ori5_callback);
hchoose = uicontrol('unit','pixel','style','pushbutton','string','back',...
'position',[1250 60 85 50],'backgroundColor',[1,0.1,0],'units','normalized','fontsize',12,'callback',@choose_callback);
hexit = uicontrol('unit','pixel','style','pushbutton','string','exit',...
'position',[1250 10 85 50],'backgroundColor',[1,0.1,0],'units','normalized','fontsize',12,'callback',@exit_callback);
* while (1)
if stopwhile==100
break;
end
if hst1==1
%subplot(2,2,1);
subplot('position',[0 0.52 0.46 0.43]);
imshow(vid1(:,:,:,frame1));
title('key','Fontsize',14);
if frame1 < size(vid1,4)
pause(1);
frame1 = frame1+1;
else
pause(1);
frame1 = 1;
end
end
if hst2==1
% subplot(2,2,2);
subplot('position',[0.46 0.52 0.46 0.43]);
imshow(vid2(:,:,:,frame2));
title('key','Fontsize',14);
if frame2 < size(vid2,4)
pause(1);
frame2 = frame2+1;
else
pause(1);
frame2 = 1;
end
end
if hst3==1
%subplot(2,2,3);
subplot('position',[0 0.02 0.46 0.43]);
imshow(vid3(:,:,:,frame3));
title('key','Fontsize',14);
if frame3 < size(vid3,4)
pause(1);
frame3 = frame3+1;
else
pause(1);
frame3 = 1;
end
end
if hst4==1
%subplot(2,2,4);
subplot('position',[0.46 0.02 0.46 0.43]);
imshow(vid4(:,:,:,frame4));
title('key','Fontsize',14);
if frame4 < size(vid4,4)
pause(1);
frame4 = frame4+1;
else
pause(1);
frame4 = 1;
end
end
if hst5==1
%subplot(2,2,4);
subplot('position',[0.46 0.02 0.46 0.43]);
imshow(vid5(:,:,:,frame5));
title('key','Fontsize',14);
if frame5 < size(vid5,4)
pause(1);
frame5 = frame5+1;
else
pause(1);
frame5 = 1;
end
end
% else
% subplot(2,2,4); imshow(vid2(:,:,:,1));
drawnow;
if f4 ==20
break;
% else f4 = f4+1;
end
end
function play1_callback(hObject1,eventdata1)
% set(hstat1,'value',1);
% hst1=1;
% set(hplay1 ,'backgroundColor',[1,1,0],'string','book-playing');
set(hpop1,'callback','str(val)');
end
function play2_callback(hObject2,eventdata2)
set(hstat2,'value',1);
hst2=1;
set(hplay2 ,'backgroundColor',[1,1,0],'string','watch-playing');
end
function play3_callback(hObject3,eventdata3)
set(hstat3,'value',1);
hst3=1;
set(hplay3 ,'backgroundColor',[1,1,0],'string','can-playing');
end
function play4_callback(hObject4,eventdata4)
set(hstat4,'value',1);
hst4=1;
set(hplay4 ,'backgroundColor',[1,1,0],'string','phone-playing');
end
function play5_callback(hObject5,eventdata5)
set(hstat5,'value',1);
hst5=1;
set(hplay5 ,'backgroundColor',[1,1,0],'string','glasses-playing');
end
function pop1_callback(hObject1,eventdata1)
val=get(hObject1,'Value');
str=get(hObject1,'String');
switch str(val)
case 'book'
set(hstat1,'value',1);
hst1=1;
set(hplay1 ,'backgroundColor',[1,1,0],'string','book-playing');
case 'watch'
set(hstat2,'value',1);
hst2=1;
set(hplay1 ,'backgroundColor',[1,1,0],'string','watch-playing');
case 'can'
set(hstat3,'value',1);
hst3=1;
set(hplay1 ,'backgroundColor',[1,1,0],'string','can-playing');
case 'phone'
set(hstat3,'value',1);
hst3=1;
set(hplay1 ,'backgroundColor',[1,1,0],'string','phone-playing');
case 'glasses'
set(hstat5,'value',1);
hst5=1;
set(hplay1 ,'backgroundColor',[1,1,0],'string','glasses-playing');
end
end *
function stop1_callback(hObject1,eventdata1)
set(hstat1,'value',0);
hst1=0;
set(hplay1 ,'backgroundColor',[0.3,0.7,1],'string','book-play');
frame1
end
function stop2_callback(hObject2,eventdata2)
set(hstat2,'value',0);
hst2=0;
set(hplay2 ,'backgroundColor',[0.3,0.7,1],'string','watch-play');
frame2
end
function stop3_callback(hObject3,eventdata3)
set(hstat3,'value',0);
hst3=0;
set(hplay3 ,'backgroundColor',[0.3,0.7,1],'string','can-play');
frame3
end
function stop4_callback(hObject4,eventdata4)
set(hstat4,'value',0);
hst4=0;
set(hplay4 ,'backgroundColor',[0.3,0.7,1],'string','phone-play');
frame4
end
function stop5_callback(hObject5,eventdata5)
set(hstat5,'value',0);
hst5=0;
set(hplay5 ,'backgroundColor',[0.3,0.7,1],'string','glasses-play');
frame5
end
function ori1_callback(hObject1,eventdata1)
set(hori1 ,'backgroundColor',[0.8,0.1,0.8],'callback','bookindex');
stopwhile=100;
close(h4);
bookindex(frame1);
end
function ori2_callback(hObject2,eventdata2)
set(hori2 ,'backgroundColor',[0.8,0.1,0.8],'callback','watchindex');
stopwhile=100;
close(h4);
watchindex(frame1);
end
function ori3_callback(hObject3,eventdata3)
set(hori3 ,'backgroundColor',[0.8,0.1,0.8],'callback','canindex');
stopwhile=100;
close(h4);
canindex(frame1);
end
function ori4_callback(hObject4,eventdata4)
set(hori4 ,'backgroundColor',[0.8,0.1,0.8],'callback','phoneindex');
stopwhile=100;
close(h4);
phoneindex(frame1);
end
function ori5_callback(hObject5,eventdata5)
set(hori5 ,'backgroundColor',[0.8,0.1,0.8],'callback','watchindex');
stopwhile=100;
close(h4);
phoneindex(frame1);
end
function exit_callback(hObject,eventdata)
f4=20;
% stop1_callback;
close gcf;
end
function choose_callback(hObject,eventdata)
set(hchoose ,'callback','fig');
stopwhile=100;
close(h4);
end
end
Jan
2012년 8월 18일
Help with what? I do not understand the message "I don't how to contiune popupmenu and pushbutton". Posting a lot of code does not help also. I suggest to ask a clear question.
And of course I recommend to omit the absolutely useless "clear all" on top of the function. Why wasting processing time for reloading all M-functions?!
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)