MATLAB: Can I count the number of integers in an index and store it in a variable

array index

index = find([X] == 1)
If I have an array X and I use index to find the where the value 1 is in the array and it gives me the following output that there are 2 places where the number 1 is found at spot [3;25]
index =
3
25
Can I store the value 2 in a variable that it found 2 integers?

Best Answer

Yes.
Xeq1 = numel(index);
This is how I would do it.
Related Question