Error in if statement

1 回表示 (過去 30 日間)
Dev 8080
Dev 8080 2020 年 4 月 30 日
回答済み: Devika Surendran 2020 年 6 月 18 日
When I am running the code I am getting the error in if statment that the matrix dimensions do not match.I have written the code to find snm of buttrfly curve of sram ie find side of square in a butterfly curve.Please help me.
[a,T,aT]=xlsread('C:\Users\De80\Desktop\inverterA.csv')
t=a(:,1);y=a(:,2);
[b,bT,bT]=xlsread('C:\Users\De80\Desktop\inverterB.csv')
s=b(:,1);r=b(:,2);
[th, q] = cart2pol(t, y);
[nx, ny] = pol2cart(th+pi/4, q);
[th_1, r_1] = cart2pol(s, r);
[nx_1, ny_1] = pol2cart(th_1+pi/4, r_1);
plot(nx,ny,'red')
hold on
axis square;plot(nx_1,ny_1,'red')
[xi,yi]=polyxpoly(nx,ny,nx_1,ny_1)
if((nx_1)<(xi))
z1=abs(ny-ny_1);
c1=max(z1)
d1=c1.*(1.414);
end
if((nx_1)>(xi))
z2=abs(ny-ny_1);
c2=max(z1)
d2=c1.*(1.414);
end
d=min(d1,d2)
disp(d)

採用された回答

Devika Surendran
Devika Surendran 2020 年 6 月 18 日
Inside the if statement, in the values compared one is a matrix and the other is a single value. For more information please refer to the below answer as well:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by