Error in if statement
3 views (last 30 days)
Show older comments
Dev 8080
on 30 Apr 2020
Answered: Devika Surendran
on 18 Jun 2020
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)
Accepted Answer
Devika Surendran
on 18 Jun 2020
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 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!