the meaning of colon in Matlab
이전 댓글 표시
Hello everyone,
I cannot understand the code below. Could you please be kind and help me?
fps = 1/8;
% Change to folder with images
cd('C:\Users\ZZHUI\Desktop\Bmp_DICOM\unnamed_2')
all_files = dir('*.dcm');
for i = 1:size(all_files,1)
info = dicominfo(all_files(i).name);
imagematrix(i,:,:) = dicomread(info);
DICOMimage(:,:) = imagematrix(i,:,:);
I cannot get the meaning of imagematrix(i,:,:) , and DICOMimage(:,:) = imagematrix(i,:,:)
Thanks!
Yang
답변 (2개)
Image Analyst
2012년 8월 11일
0 개 추천
It means "all of that dimension", so A(:, 5) means all rows in column 5, and imagematrix(i, :, :) means the x dimension (if that's what it means) is "i" and you're taking all y and all z for which x == i. In other words, you're taking a y-z slice in the 3D image along the plane x=i.
Azzi Abdelmalek
2012년 8월 11일
imagematrix(i,:,:) is 3D matrix
suppose you have 4 matrix 3x2 we can save all 4 matrix in one variable M
M(:,:,1) is the first matrix 3x2,
M(:,:,2) is the second matrix 3x2
...
M(:,:,4) is the fourth matrix 3x2
the first ":" means all line
the second ":" means all columns
the third ":" means all matrix
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!