Error: Function definition not supported in this context. Create functions in code file.

1 回表示 (過去 30 日間)
Cody Abt
Cody Abt 2019 年 9 月 19 日
回答済み: Jyothis Gireesh 2019 年 11 月 22 日
My function with code prompt being user input.
function [v]=Deflection_Caabt(x)
if (0 < prompt) && (prompt <= 120)
(1/(3.19*10e9)) * 800*xe3 - 13.68 * 10e6 - 2.5*xe4;
else
(120 < prompt) && (prompt <= 240);
(1/(3.19*10e9))*800*xe3-(13.68*10e6)-2.5*xe4+2.5*(x-120)*e4;
Elseif
(240 < prompt) && (prompt <= 360);
(1/(3.19*10e9))*(800*xe3-(13.68*10e6)-2.5*x^4+2.5*x-120e4+600*(x-240)*e3);
end

回答 (1 件)

Jyothis Gireesh
Jyothis Gireesh 2019 年 11 月 22 日
One method may be to include an input statement using “input()” to accept the value of “prompt”. Another possible workaround is to accept the user input outside the function and to pass it as an argument to the function.

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by