Too many Input Arguments Error

clear all; close all; clc;
img = imread("Morfoloji2.PNG");
gray=rgb2gray(img);
bin=imbinarize(gray);
binm=imcomplement(bin);
binf=imfill(binm,'holes');
[centers, radii, metric]=imfindcircles(binf,[6,50],'Sensitivity',0.60);
bint=imerode(binf,strel('disk',1));
imshow(bint);
[labeledImage, numberOfObjcts]=bwlabel(bint);
B=regionprops(labeledImage,'Perimeter','Area');
circu=[B.Perimeter.^2] ./(4*pi*[B.Area]);
% cats=cat(1,B.Centroid);
viscircles(centers, B.Area,'EdgeColor','b');
-------------------------------------------------------------------------------------------------------------------------------------------
My error is:
Error using .^
Too many input arguments.
Error in dsgsdgs (line 12)
circu=[B.Perimeter.^2] ./(4*pi*[B.Area]);
>>

2 件のコメント

Daniel Pollard
Daniel Pollard 2021 年 4 月 23 日
What does it return if you call
disp(B.Perimeter)
before the error message?
Onur Demir
Onur Demir 2021 年 4 月 23 日
I got this error:
Error using disp
Too many input arguments.
Error in Morfoloji2 (line 12)
disp(B.Perimeter);
We are working together.

サインインしてコメントする。

回答 (2 件)

Jan
Jan 2021 年 4 月 23 日
編集済み: Jan 2021 年 4 月 23 日

2 投票

This means, that your B.Perimeter is not a scalar. Do you mean:
% Was: circu=[B.Perimeter.^2] ./(4*pi*[B.Area]);
circu=[B.Perimeter].^2 ./(4*pi*[B.Area]);
You have done the same at [B.Area] : If you include multiple values in the square brackets, they are concatenated to a vector.

2 件のコメント

Onur Demir
Onur Demir 2021 年 4 月 23 日
Thank you for answer. Its worked 👍
Stephen23
Stephen23 2021 年 4 月 23 日
-> This means, that your structure B is not a scalar.

サインインしてコメントする。

Walter Roberson
Walter Roberson 2021 年 4 月 23 日

1 投票

circu=[B.Perimeter].^2 ./(4*pi*[B.Area]);

1 件のコメント

Onur Demir
Onur Demir 2021 年 4 月 23 日
Thank you for answer. Its worked 👍

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangePerformance and Memory についてさらに検索

タグ

質問済み:

2021 年 4 月 23 日

コメント済み:

2021 年 4 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by