why does it not work on my matlab this example from the book
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Here are an example with matlab elseif and my attempt to rewrite it without success:
This is my script:
y=calcy(x)
if x<-1
y=1;
elseif x<=2
y=x^2;
else
y=4;
end
end
And why do they need two end. What are the two things they are ending?
0 comentarios
Respuesta aceptada
David Young
el 15 de Oct. de 2011
The second end is the end of the function. If you run the code outside a function, you must omit it.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!