# MATLAB: The for loop is not extracting all the possible values

findfloating pointfor loopsMATLAB

My for loop isn't extracting all the possible values in the x variable (a 61-by-61 double). I am looping through the x values in a straight horizontal line (like increments).
The x 61-by-61 double is 61 columns of values from -3 to 3 in increments of 0.1. For example, all of column thirty-one is 0, all of column thirty-two is 0.1, all of column thirty-three is 0.2, then it goes 0.3,0.4,0.5…2.6,2.7,2.8,2.9, 3.
This is a small step in a geology project. I've tried using the numel function to loop through all the values within the x variable. Still got the same error.
I am only getting 0, 0.5, 1, 1.5, 2, 2.1, 2.2, 2.5, 2.6, 2.7, and 3, no matter what I try. These are columns, 31, 36, 41, 46, 51, 52, 53, 56, 57, 58, and 61.
I've tried doing this as well to grab the row and the columns (because technically, that's my end goal):
``for idx = 0.0000:0.1000:3.0000 %each increment within the line    if find(x == idx) %if they equal and it is true, thus returning 1         [row,col] = find(x == idx); %get the row/column        disp([row,col]) %display such    endend``
However, I only get columns, 31, 36, 41, 46, 51, 52, 53, 56, 57, 58, and 61 which corresponds to the error values I am getting from before.
This is what I have so far:
``% this is the straight linexln = [0.0 3.0];yln = [0 0];plot (xln, yln);xln = [0.0000 3.0000]; %the x values from the straight linefor idx = 0.0000:0.1000:3.0000 %each increment within the line    disp(x(x == idx)) %if x is the same as the index, then display itend``
or
``for idx = 0.0000:0.1000:3.0000 %each increment within the line    if find(x == idx) %if they equal and it is true, thus returning 1      [row,col] = find(x == idx); %get the row/column      disp([row,col]) %display such    endend``
I am suppose to be getting ALL the values between 0 and 3 by increments of 0.1 because those all exist in the x 61×61 double.

``>> a = 0.1 + 0.1 + 0.1a =                       0.3>> b = 0.3b =                       0.3>> a == b   %return false!ans =  logical   0>> abs(a-b) < 1e-12 %proper way to check for equalityans =  logical   1``
``idx = 0.0000:0.1000:3.0000matchingxindex = find(ismembertol(x, idx));  %loop not required``
``[row, col] = ind2sub(size(x), matchingxindex)``