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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/511577/image.png)
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
0 件のコメント
採用された回答
Image Analyst
2021 年 2 月 6 日
drawrectangle() was not introduced until R2020a. You will have to use rbbox() or imrect() instead.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!