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

1 view (last 30 days)
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;
(120 < prompt) && (prompt <= 240);
(240 < prompt) && (prompt <= 360);

Answers (1)

Jyothis Gireesh
Jyothis Gireesh on 22 Nov 2019
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.


Find more on Introduction to Installation and Licensing 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!