フィルターのクリア

why does it not work on my matlab this example from the book

1 回表示 (過去 30 日間)
Tor Fredrik Hove
Tor Fredrik Hove 2011 年 10 月 15 日
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?

採用された回答

David Young
David Young 2011 年 10 月 15 日
The second end is the end of the function. If you run the code outside a function, you must omit it.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by