user3440716
user3440716

Reputation: 649

how to set the position of image in matlab

i am new in matlab and making some practice . I have drawn this black box. i want to move or change position of this box. for example moving to right or moving up or down and so on.

enter image description here

my code:

function im = i(r,c)
%UNTITLED9 Summary of this function goes here
%   Detailed explanation goes here
Blk_blk= zeros(r,c);
k=imshow(Blk_blk);
%j= imresize(k,100);

xl = get(Blk_blk, -10);   %for position x way
yl = get(Blk_blk, -10);   % for position y way

set(Blk_blk, -10, xl, -10, yl);
end

please specify me if i am using wrong approach in specifying the positioning in x,y (that is x and y ) thanks in advance

Upvotes: 0

Views: 1356

Answers (1)

Drake
Drake

Reputation: 857

Try the following.

Up to this point in your code

r = 10;
c = 10;
k = imshow(zeros(r, c));

you get

enter image description here

and after you execute the commands

llc_dx = 0.2;
llc_dy = 0.1;
set(gca, 'Position', get(gca, 'Position') + [llc_dx llc_dy 0 0])

you get

enter image description here

Upvotes: 2

Related Questions