error reading Philips dicom images

Search for matlab dicomread error I found only one post but no answer, so I ask the same question here.
Using this code:
My dicom image has only 3 slices.
for p=1:3 filename = sprintf('IM_0022.dcm', p); X(:,:,1,p) = dicomread(filename); end
error: ??? Assignment has more non-singleton rhs dimensions than non-singleton subscripts
I tried several modifications but still got the same error.
Please help and thanks for your time.

Answers (1)

hi pom,
You mean that your samples are named : 'IM_0022.dcm1, 'IM_0022.dcm2, 'IM_0022.dcm3 ?
If this is the case then you have string concatenation rather than sprintf simply because the last function does not take the variable p as string :
try :
for p=1:3
filename=strcat('IM_0022.dcm',num2str(p));
X(:,:,1,p) = dicomread(filename);
end

Categories

Asked:

pom
on 15 Aug 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!