prompt user to reenter function

3 visualizaciones (últimos 30 días)
k khaja
k khaja el 12 de En. de 2021
Editada: Adam Danz el 15 de En. de 2021
If user enters a fuction with mistake, how can we prompt the user to reenter function.
funstr = input('Please enter your function in format: 4*x^3 + 2*x^2 + x + 5: ', 's')
f = str2func( ['@(x) ' funstr ] )
Thanks in advance

Respuestas (1)

Adam Danz
Adam Danz el 12 de En. de 2021
Editada: Adam Danz el 15 de En. de 2021

Categorías

Más información sobre Entering Commands 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!

Translated by