Filter löschen
Filter löschen

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

7 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Image Analyst
Image Analyst am 6 Feb. 2021
drawrectangle() was not introduced until R2020a. You will have to use rbbox() or imrect() instead.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by