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

7 次查看(过去 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