Info
This question is closed. Reopen it to edit or answer.
Why is my matrix dimensions off?
1 view (last 30 days)
Show older comments
So the goal is to create a matrix and convert that to an image. Below is my code. It runs and prints out a 10x10 matrix and the image, but the checker says y has a value of [1 1] instead of [10 10]. Why is that happening?
function [N,M] = smooth_image(x)
y=x
[N,M]=size(x)
for k=2:N-1
for c=2:M-1
y(k,c)=mean(mean(x(k-1:k+1,c-1:c+1)))
y
end
end
end
6 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!