2

2 つの画像を 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')
4

0 に答える 0