matlab读取多张图片

为什么总是报错,读取那行报错
clear all
close all
clc
for p=1:3
pic0=imread(int2str(p),'.bmp');%%用此图,能明显对比出比直方图均衡好很多,与原图对比几乎没差别

pic=pic0;
pic = rgb2gray(pic0);
。。。
。。。
。。。
后面略
图片存在了跟这个程序一起的文件夹里

??? Error using ==> imread at 357
Can't open file "F:\study\CT-1\" for reading;
you may not have read permission.

Error in ==> gray_level_hisgram2 at 40
pic0=imread('F:\study\CT-1\',int2str(p),'.bmp');

第1个回答  推荐于2016-12-06
for p=1:3
filename = [int2str(p) '.bmp'];
pic[p] = imread(filename,'bmp');
....追问

不好意思还要追问一下

我程序一开始就是
clc
for p=1:3
。。
。。
这样对么?报错啊

??? Undefined function or variable 'p'.

还有 存的时候怎么存 我原来是

imwrite(pic,num2str(p),'.bmp','BMP');

本回答被提问者采纳
相似回答