# Revision history [back]

### how to make a new mat variable with 9 elements

Hi, I want make a new mat file of 9 element where i can add the 4 pixel of a mat image in its corner and the row and clumns in the mat. and in the middle the mat image itself. how i can do this. i am not able to create a mat variable with 9 elements.

i have done this in matlab.

I=imread('1.jpg'); in= im2double(rgb2gray(I)); [row col]=size(in); h = ones(5); out1=stdfilt(in,h); %Standard deviation from inbuilt function imshow(out1);

%% Replicating two rows and two columns on all the four sides of image image1=[ in(1,1), in(1,:), in(1,col); in(:,1), in, in(:,col); in(row,1), in(row,:), in(row,col)];

### how to make a new mat variable with 9 elements

Hi, I want make a new mat file of 9 element where i can add the 4 pixel of a mat image in its corner and the row and clumns in the mat. and in the middle the mat image itself. how i can do this. i am not able to create a mat variable with 9 elements.

i have done this in matlab.

I=imread('1.jpg'); in= im2double(rgb2gray(I)); [row col]=size(in); h = ones(5); out1=stdfilt(in,h); %Standard deviation from inbuilt function imshow(out1);

%% Replicating two rows and two columns on all the four sides of image image1=[ in(1,1), in(1,:), in(1,col); in(:,1), in, in(:,col); in(row,1), in(row,:), in(row,col)];

here in(1,1),in(1,col),in(row,1), in(row,col) are the 4 corner of new mat variable, and in is the previous mat image and else are the boundries of the new mat variable.

this is like adding a row and a column in existing image, so that i can do furter calcualtion.

help me.

thanks

### how to make a new mat variable with 9 elements

Hi, I want make a new mat file variable (image) of 9 element where i can add the 4 pixel of a mat image in its corner and the row and clumns in the mat. and in the middle the mat image itself. how i can do this. i am not able to create a mat variable with 9 elements.

i have done this in matlab.

I=imread('1.jpg'); in= im2double(rgb2gray(I)); [row col]=size(in); h = ones(5); out1=stdfilt(in,h); %Standard deviation from inbuilt function imshow(out1);

%% Replicating two rows and two columns on all the four sides of image image1=[ in(1,1), in(1,:), in(1,col); in(:,1), in, in(:,col); in(row,1), in(row,:), in(row,col)];

here in(1,1),in(1,col),in(row,1), in(row,col) are the 4 corner of new mat variable, and in is the previous mat image and else are the boundries of the new mat variable.

this is like adding a row and a column in existing image, so that i can do furter calcualtion.

help me.

thanks

 4 No.4 Revision StevenPuttemans 19876 ●14 ●82 ●205 http://stevenputtemans...

### how to make a new mat variable with 9 elements

Hi, I want make a new mat variable (image) of 9 element where i can add the 4 pixel of a mat image in its corner and the row and clumns in the mat. colums in the mat, and in the middle the mat image itself. how How i can do this. i this? I am not able to create a mat variable with 9 elements.

i I have done this in matlab.

I=imread('1.jpg');
in= im2double(rgb2gray(I));
[row col]=size(in);
h = ones(5);
out1=stdfilt(in,h);   %Standard deviation from inbuilt function
imshow(out1); imshow(out1);

%% Replicating two rows and two columns on all the four sides of image
image1=[ in(1,1), in(1,:), in(1,col);
in(:,1), in,      in(:,col);
in(row,1), in(row,:), in(row,col)]; here in(row,col)];


Here in(1,1),in(1,col),in(row,1), in(row,col) are the 4 corner of new mat variable, and in is the previous mat image and else are the boundries boundaries of the new mat variable.

this This is like adding a row and a column in existing image, so that i can do furter calcualtion.

help me.

thanks