So I have a single value u ( between 0 and one generated by rand) and I have a n dimensional vector, let's say C .I want to compare this u to every element of the C vector and find the lowest i such that u < C(i), for example u = 0.2 and C = [0.1 0.15 0.21 0.37 0.54 0.87 1].' , then my algorithms needs to find 0.21 which is C(3) and gives me the i (=3 in this case) back.
MATLAB: How to compare an integer to the elements of a vector
MATLAB and Simulink Student Suiterandom sampling
Related Question
- How to find the nth is the higher than and closest to 0.3
- How to perform Principal component analysis
- Find following values and represent them in a matrix
- How to replace the values of a matrix
- How to replace values in a matrix
- How to compare some specific entries of a matrix, if I have their indices stored in 2 files
Best Answer