Why my simulink Matlab Function block tell my that my matrix was not defined??

1 view (last 30 days)
Here is my simulink Matlab Function block code. Is there something wrong with my code? Cause it shows that 'y' is not defined.
function U = self_intern(u)
%#codegen
% in=imread('3.jpg','jpg');
% u=rgb2gray(in);
% u=in(:,:,1);
[a,b]=size(u);
y=zeros(2*a,2*b);
[X,Y]=meshgrid(1:b,(1:a)');
[XI,YI]=meshgrid(1:0.5:(b+0.5),(1:0.5:(a+0.5))');
y=interp2(X,Y,u,XI,YI,'nearest');
y(:,2*b)=y(:,2*b-1);
y(2*a,:)=y(2*a-1,:);
U=y;
% figure;
%
imshow(X)**

Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!