Creating a logic loop which changes individual vector entries
Show older comments
Hi, I was wondering if it would be possible to create a logic loop for a vector that checks each entry of the vector, and changes it if it does not meet the criteria. Example:
h = 72;
tflange = [4/4, 5/4, 6/4, 7/4, 8/4];
hvec = ones(1,length(tflange))*h;
twmin = ((hvec-(2*tflange))*36)/(0.4*29000); %A 1x5 vector composed of
%positive real values less than 1
i = ones(1,length(tflange))*5;
while (i/16) < twmin
i = (ones(1,length(tflange)))+i;
end
tweb = i/16;
This will change all entries of the vector, but I need to only change the ones that don't meet the criteria. So if twmin is
[0.2, 0.22, 0.3, 0.32, 0.4]
I want tweb to be
[5/16, 5/16, 5/16, 6/16, 7/16]
not
[7/16, 7/16, 7/16, 7/16, 7/16]
Any help will be greatly appreciated.
Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!