Error : "Assignment has more non-singleton rhs dimensions than non-singleton subscripts"

I am getting this error: can you help me please
Assignment has more non-singleton rhs dimensions than non-singleton subscripts at
OrientationEnd(ind,1) = Table(i,j);
% Finding Orientation ...
Table=[3*pi/4 2*pi/3 pi/2 pi/3 pi/4
5*pi/6 0 0 0 pi/6
pi 0 0 0 0
-5*pi/6 0 0 0 -pi/6
-3*pi/4 -2*pi/3 -pi/2 -pi/3 -pi/4];
% Ridge Ending Orientation ...
for ind = 1:length(CentroidEndX)
Klocal = K(CentroidEndY(ind)-2:CentroidEndY(ind)+2,CentroidEndX(ind)-2:CentroidEndX(ind)+2);
Klocal(2:end-1,2:end-1) = 0;
[i,j] = find(Klocal);
OrientationEnd(ind,1) = Table(i,j);
end
Table is a 5X5 matrix

2 件のコメント

Rik
Rik 2018 年 3 月 31 日
This will occur if there are more than one items in i and j.
Vishal Saini
Vishal Saini 2018 年 3 月 31 日
How can i resolve this error ? How can i use the first value of i and j if many values occur ?
Thanks

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

 採用された回答

Rik
Rik 2018 年 3 月 31 日
If you want to use only the first element, you can use the code below. This might still result in an error if no valid positions are found by find.
% Finding Orientation ...
Table=[3*pi/4 2*pi/3 pi/2 pi/3 pi/4
5*pi/6 0 0 0 pi/6
pi 0 0 0 0
-5*pi/6 0 0 0 -pi/6
-3*pi/4 -2*pi/3 -pi/2 -pi/3 -pi/4];
% Ridge Ending Orientation ...
for ind = 1:length(CentroidEndX)
Klocal = K(CentroidEndY(ind)-2:CentroidEndY(ind)+2,CentroidEndX(ind)-2:CentroidEndX(ind)+2);
Klocal(2:end-1,2:end-1) = 0;
[i,j] = find(Klocal);
OrientationEnd(ind,1) = Table(i(1),j(1));
end

その他の回答 (0 件)

カテゴリ

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

質問済み:

2018 年 3 月 31 日

コメント済み:

2018 年 3 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by