The first argument to INPUT must be a character vector.

3 views (last 30 days)
x = input("Enter the value for x (inside [-1,1]): ");
if x < -1 || x > 1
disp("Error: the x value is not a valid input")
else
num_dec = input("Enter the number of decimal values desired for accuracy: ");
tol = 1 / (10^num_dec);
end
Not gonna post all of my code yet. first one im getting error pls help and explained why
  2 Comments
Geoff Hayes
Geoff Hayes on 23 Apr 2020
Kathy - which call to input does this error message correspond to? The first, the second, or both? Please copy and paste the full error message to this question. And does your version of MATLAB support double quotes for strings?

Sign in to comment.

Answers (1)

Ameer Hamza
Ameer Hamza on 23 Apr 2020
You are probably using an older Release of MATLAB, which does not support strings. Try to replace double-quotes with single-quotes.
x = input('Enter the value for x (inside [-1,1]): ');

Categories

Find more on Entering Commands in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!