필터 지우기
필터 지우기

Problem of using "imagesc" function

조회 수: 11 (최근 30일)
Amit Chakraborty
Amit Chakraborty 2022년 3월 11일
답변: DGM 2022년 3월 11일
When I execute the following code it runs perfectly and shows me the slices.
for i = 1:64
figure(1); imagesc(imgaussfilt3(max(img(:,:,i),0))); axis off; axis equal; colormap gray; colorbar;
title(num2str(i));
% caxis([0 0.01]);
% caxis([0.010 0.025]);
% caxis([0.5 2.5]);
pause(0.50);
end
% But I want to plot the slices on the Y axis protion Like:
for i = 1:64
figure(1); imagesc(imgaussfilt3(max(img(:,i,:),0))); axis off; axis equal; colormap gray; colorbar;
title(num2str(i));
% caxis([0 0.01]);
% caxis([0.010 0.025]);
% caxis([0.5 2.5]);
pause(0.50);
end
%% Error : I am having the following error.
Error using image
Color data must be an m-by-n-by-3 or m-by-n matrix.
Error in imagesc (line 52)
hh = image(varargin{:}, 'CDataMapping', 'scaled');
%% Can anyone help me in this issue. Thanks in advance for your kind help.

답변 (1개)

DGM
DGM 2022년 3월 11일
You need to reorient the data. You could use permute(), or you can do it with squeeze():
imagesc(imgaussfilt3(max(squeeze(img(:,i,:)),0)));

카테고리

Help CenterFile Exchange에서 Orange에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by