R=[8902 29260 140589 12088 3906 70892 130791 59007 31802 2019];k=0;for x=1:length(R) if R(x)<=2200 k=k+1; f_laminar=(14)/(R(x)); fprintf('The number of times the data was in laminar is %4.3f.',k) elseif (2200<R(x))&(R(x)<1000000) k=k+1; f_transition=(0.0891)/(R(x)^0.21); fprintf('The number of times the data was in transition is %4.3f.',k) elseif R(x)>=1000000 k=k+1; f_turbulant=0.006; fprintf('The number of times the data was in turbulant %4.3f.',k) endend
MATLAB: How to find the number of times the data is in laminar, transition, and turbulent given the conditions
for loopif statement
Related Question
- What is wrong with fprintf
- Load multiple files, but it only returns the data in last file
- Appending matrices to binary file – recover with fread and reshape
- How do you finish this for loop? It is telling me to define the variable “total”, but what do I put in order for it to flow with the loop
- How get digits as in file
Best Answer