If statement with multiple variables, or if the variables can be shortened.
Show older comments
x is a decimal number always smaller than one based on the users input.

So I want the program to check if the value of a,b,c or d is less than a certain value or greater than, and produce an output.
Accepted Answer
More Answers (1)
Asad (Mehrzad) Khoddam
on 18 Oct 2020
if x<1 && x<=0.75
a = x - 0.75;
elseif x>=0.5
b = x - 0.5;
elseif x>=2.5
c = x - 0.25;
else
d = x;
end
% make an array of values
v = [a, b, c , d];
if all(v>0.1) && all(v<=0.6)
dime = 1;
end
Categories
Find more on Creating and Concatenating Matrices 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!