2012-04-23 65 views
2

我需要將兩個圖像添加到一個matlab圖形,並將它們移動到設置路徑中。但是當我調整它的大小時,我的圖像加載了完整的大小,它只是對它進行了像素化處理,而當我嘗試移動它時,它失敗了。繼承人我的代碼:MATLAB,移動圖像

close all 
clc 
clear all 

fh = figure; 
bgh = uibuttongroup('Parent',fh,'Title',... 
    'John''s Animation','Position',[.1 .2 .8 .6]); 
set(bgh,'FontName','Trebuchet MS','FontSize',15) 
rbh1 = uicontrol(bgh,'Style','radiobutton','String','START CAR!',... 
    'Units','normalized','Position',[.1 .6 .3 .2]); 
rbh2 = uicontrol(bgh,'Style','radiobutton','String','STOP!',... 
    'Units','normalized','Position',[.1 .4 .3 .2]); 
set(rbh1,'FontName','Trebuchet MS', ... 
    'FontSize',15,'ForegroundColor','r') 
set(rbh2,'FontName','Trebuchet MS', ... 
    'FontSize',15,'ForegroundColor','g') 

% axis ([2 1 2 1]) 
axis square off 
car = imread('car.jpg'); 
carg = rgb2gray(car); 
% carg = imresize(car,1); 
h = imshow(carg); 

steps = linspace(0,2,1000); 

set(rbh1,'CallBack','for i = 1:200, set(h,''XData'',steps(i)),pause(0.0001),end') 

回答