Undefined function 'drawrectangle' for input arguments of type 'char'?

조회 수: 4 (최근 30일)
Trying to utilize the 'drawrectangle' function but it's giving me the error you see in the question. I am using R2018a.
This for loop I created (seen below) is to place a series of rectangles of a pre-defined length onto an image. The RawRNA.Data structure are all numbers and correctly defined with the columns of x1, y1, x2, and y2, respectively.
Both variables "w" and "h" (the respective lengths of the rectangle) are being correctly defined too. Below is a screenshot of what RawRNA.Data looks like.
Am I missing something fundamental in the code? Assume everything else before 'drawrectangle' is correctly defined. I'm also happy to provide additional information as you need.
numberofrectangles1=size(RawRNA.Data,1);
A=false(dims.vRNA.(NHPname)(1),dims.vRNA.(NHPname)(2));
figure('Position',[1 1 dims.vRNA.(NHPname)(2) dims.vRNA.(NHPname)(1)])
imshow(adj.vRNA.(NHPname))
axis image;
hold on;
for k = 1 : numberofrectangles1
w=(RawRNA.Data(k,3)-RawRNA.Data(k,1));
h=(RawRNA.Data(k,4)-RawRNA.Data(k,2));
rect=drawrectangle('Position',[RawRNA.Data(k,1),RawRNA.Data(k,2),w,h],'Color','r','LineWidth',1);
rna_roi=createMask(rect);
for j = 1 : dims.vRNA.(NHPname)(1)
for n = 1 : dims.vRNA.(NHPname)(2)
if rna_roi(j,n)==1
A(j,n)=1;
end
end
end
end

채택된 답변

Image Analyst
Image Analyst 2021년 2월 6일
drawrectangle() was not introduced until R2020a. You will have to use rbbox() or imrect() instead.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by