why am i getting syntax error for linspace in If statement?

2 Ansichten (letzte 30 Tage)
siddhesh rane
siddhesh rane am 2 Jul. 2013
if (Z(1,1)==z && Z(2,1)== z && Z(3,1)==z)
{
t = linspace(0,1); % case 1 = when triangle is parallel to cutting plane
x = X(1,1)+t*(X(2,1)-X(1,1));
y =Y(1,1)+t*(Y(2,1)-Y(1,1));
z = Z(1,1)+t*(Z(2,1)-Z(1,1));
plot3(x,y,z);
hold on;
x = X(2,1)+t*(X(3,1)-X(2,1));
y = Y(2,1)+t*(Y(3,1)-Y(2,1));
z = Z(2,1)+t*(Z(3,1)-Z(2,1));
plot3(x,y,z);
hold on;
x = X(1,1)+t*(X(3,1)-X(1,1));
y = Y(1,1)+t*(Y(3,1)-Y(1,1));
z = Z(1,1)+t*(Z(3,1)-Z(1,1));
plot3(x,y,z);
hold on;
}
i am getting "The expression to the left of the equals sign is not a valid target for an assignment" error for linspace line.can anyone explain?

Akzeptierte Antwort

Evan
Evan am 2 Jul. 2013
Take out the brackets { }
  2 Kommentare
siddhesh rane
siddhesh rane am 2 Jul. 2013
Thanx a lot for quick reply..it worked :)
Evan
Evan am 2 Jul. 2013
Bearbeitet: Evan am 2 Jul. 2013
You're welcome! :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by