Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 使用'存储和访问图像的高度和宽度;尺寸';在Matlab中_Image_Matlab_Vector_Indexing - Fatal编程技术网

Image 使用'存储和访问图像的高度和宽度;尺寸';在Matlab中

Image 使用'存储和访问图像的高度和宽度;尺寸';在Matlab中,image,matlab,vector,indexing,Image,Matlab,Vector,Indexing,我需要在Matlab中的图像的高度和宽度。下面几行就是这样做的 rgbImage = imread('peppers.bmp'); disp(size(rgbImage)); 输出:图像大小: 691003 接下来,我只想打印(存储)其中的一个。所以我做了 Imgsize=size(rgbImage); disp(Imgsize(0)); 这会引发以下错误:“试图访问Imgsize(0);索引必须是 正整数或逻辑整数 我做错了什么?MATLAB不是0索引的。数组索引从1开始,因此需要执行“

我需要在Matlab中的图像的高度和宽度。下面几行就是这样做的

rgbImage = imread('peppers.bmp');
disp(size(rgbImage)); 
输出:图像大小: 691003

接下来,我只想打印(存储)其中的一个。所以我做了

Imgsize=size(rgbImage);
disp(Imgsize(0));
这会引发以下错误:“试图访问Imgsize(0);索引必须是 正整数或逻辑整数


我做错了什么?

MATLAB不是0索引的。数组索引从1开始,因此需要执行“disp(ImgSize(1))”

尝试
ImgSize(1)
,在matlab中,索引从1开始,而不是从0开始