How to apply if else statement by reading values from a Table file on each value and save output?
Show older comments
So, I have this code, This is working fine when only one value of Turbidity is given, it successfully gives me a output of TurbidityNEW.
num_col = size(Turbidity);
for i=1:num_col
if Turbidity < 5 % Condition 1
TurbidityNEW = 1;
elseif Turbidity >=5 & Turbidity <= 10 % Condition 2
TurbidityNEW = Turbidity/5;
elseif Turbidity > 10 & Turbidity <= 500
TurbidityNEW = (Turbidity+43.9)/34.5; % Condition 3
end
end

But, I need, this code to read multiple values of Turbidity from a Table(or double), then find where it lies, in condition 1 or 2 or 3, & then run the specific statement and give me the TurbidityNEW values in a table (or double).

Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!