필터 지우기
필터 지우기

Why "Attempt to grow array along ambiguous dimension." only for some images?

조회 수: 2 (최근 30일)
Siegmund Nuyts
Siegmund Nuyts 2022년 3월 11일
댓글: Walter Roberson 2022년 3월 12일
I am analysing images in MATLAB and the code I have is running fine for most images.
I get the error: "Attempt to grow array along ambiguous dimension." for some images.
Why is this happening? I assume that the code is correct, as it works for most images...
The code runs into the issue here:
%Extract contour
RminusBdouble = double(Iplan(:,:,1))- double(Iplan(:,:,3));
%Mask out data outside of ROI (ROI determined from transects)
ROIx = [transects.x(1,:) fliplr(transects.x(2,:))]; %Transects file determines the ROI
ROIy = [transects.y(1,:) fliplr(transects.y(2,:))]; %Transects file determines the ROI
Imask = ~inpoly([X(:) Y(:)],[ROIx',ROIy']); %use the function inpoly instead of inpolygon as it is much faster
RminusBdouble(Imask) = NaN; %Mask data
%Imask = find(RminusBdouble==0); %Also remove regions of black colour
%RminusBdouble(Imask) = NaN; %Mask data
c = contours(X,Y,RminusBdouble,[thresh thresh]);
  댓글 수: 1
Siegmund Nuyts
Siegmund Nuyts 2022년 3월 11일
The issue is resolved now.
I recalled an array with different dimensions, which caused the error.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2022년 3월 11일
In arrays, the X coordinate is the second coordinate, not the first.
  댓글 수: 2
Siegmund Nuyts
Siegmund Nuyts 2022년 3월 11일
Thanks. I tried changing that but the issue remains...
Also, the code works for some images but not all of them so I'd think the fundamentals of the code are correct?
Walter Roberson
Walter Roberson 2022년 3월 12일
How are you building X and Y for the inpoly test ?

댓글을 달려면 로그인하십시오.


yanqi liu
yanqi liu 2022년 3월 12일
yes,sir,may be check
size(Iplan)
if is 2 dimension,may be can not use Iplan(:,:,3)

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by