Can anyone create an "if else while or for" from this table?

Create "if elseif, else, while, or for" by using the input function. for example, variable x means resistivity, so the beginning of the script is x = input('Enter a value for Resistivity: '); and the next is a conditional statement (if, elseif, else, while or for)

2 Comments

Jan
Jan on 26 Apr 2021
Edited: Jan on 26 Apr 2021
"urgent"? More urgent than other questions? Do you expect assistance for future questions? Then it would be a good idea to consider the etiquette in the forum.
Please post, what you have tried so far. Reading the table in loud words is almost the correct syntax for the Matlab code.
If this isn't a homework assignment that requires you to use if etc. I recommend using discretize instead.

Sign in to comment.

Answers (1)

x = input('Enter a value for Resistivity: ');
if x < 500
Prop = 'Highly Corrosive';
elseif x < 2000 % No need to check for < 500 a 2nd time
... % Please fill in the rest
end

Asked:

on 26 Apr 2021

Commented:

on 26 Apr 2021

Community Treasure Hunt

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

Start Hunting!