Error using Input function "The second argument to INPUT must be 's'."
Show older comments
I have created two simple for loops that scan a two dimensional matrix for negative integers. At every value that is negative, the user is asked to enter a new value at its corresponding temperature. (column 1 of the matrix is strictly temperature values so when I ask the user to enter a new value, it will tell them at what temperature that value pertains to). I also included a while loop so that the user is constantly asked to enter new values until they enter a value that is a positive integer. However, I am getting the following error:
Error using input
The second argument to INPUT must be 's'.
Error in Project2 (line 46)
saturated_data(i,j) = input('Please replace the value at temperature %g: ',saturated_data(1,i));
Code:
for i = 1:1:r_sat
for j = 2:1:c_sat
while saturated_data(i,j) < 0
saturated_data(i,j) = input('Please replace the value at temperature %g: ',saturated_data(i,1));
end
end
end
If someone could please tell me how I can fix this error, I would greatly appreciate it. I think it has something to do with the statement changing at every iteration.
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!