cd Change current working directory.
cd directory-spec sets the current directory to the one specified.
cd .. moves to the directory above the current one.
cd, by itself, prints out the current directory.
WD = cd returns the current directory as a string.
>> a=cd
a =
D:\Administrator\ImageProcess_Matlab
2. 利用dir读取文件夹的文件名
D =dir('directory_name') returns the results in an M-by-1 structure with the fields:
name -- Filename
date -- Modification date
bytes-- Number of bytes allocated to the file
isdir --1if name is a directory and0ifnot
datenum -- Modification date as a MATLAB serial date number.
This value is locale-dependent.
3. 代码
a = cd;
dir_src=dir(a);for i=3:1:length(dir_src)
I=dicomread(dir_src(i).name);% metadata = dicominfo('**.dcm');%存储信息
% imagesc(I);%显示图像
% dicomwrite(I,'**.dcm',metadata);%写入Dicom图像
figure('Units','centimeter','Position',[2+i 5158.5]);# resize
J = imresize(I,5,'nearest');# show
imshow(I,'DisplayRange',[]);
pause(0.3)
end
Matlab中批读取DCM文件1. 利用cd读取路径2. 利用dir读取文件夹的文件名3. 代码1. 利用cd读取路径cd Change current working directory. cd directory-spec sets the current directory to the one specified. cd .. moves to the directory above the current one. cd, by itself, prints o