Matlab代码中的错误 [英] Error in my matlab code
本文介绍了Matlab代码中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想问一个我在MATLAB中遇到的问题
我的工作是缩小图像,然后回到原始图像.
问题是,当我运行代码时,它是给我的:
I want to ask about a problem that I faced in MATLAB
my work about zoom out an image and then back to original image.
The problem is that when I ran my code it was gave me this :
??? Attempted to access I1(1,38); index out of bounds because size(I1)=[45,37].
Error in ==> sh at 23
I2(i, j)=I1(i,j);
这是我的代码:
and this is my code:
%this is for back to original image
I2= zeros(m,n);
I2 = im2double(I1);
for i=1:m
for j=1:n
I2(i, j)=I1(i,j); %The error that show here
end
end
谢谢您的帮助.
Thank you for your help
推荐答案
dedoooo写道:
dedoooo wrote:
???尝试访问I1(1, 38 ); 索引超出范围,因为size(I1)= [45, 37 ].
??? Attempted to access I1(1,38); index out of bounds because size(I1)=[45,37].
该错误明确表明您正在尝试访问第 38 个元素,但是该数组仅包含 37 元素.所以改变它.
仅供参考
查看全文