I have created an array tP
which contains a mix of integer and non-integer elements. I want to create a new array of the integer element.
The result I would like is in the same form as is returned for, for example:
tP2=find(tP>300);
That is, a list of the element numbers which contain integer values, not a list of the integers themselves.
From this I will then select the desired elements like so:
tP3=tP(tP2);
To do this for integers, what I currently have is:
tP2=find(isinteger(int16(tP)));
But instead of a list of element numbers, I just get tP2=1
returned.
Why does isinteger
not work in this case and how can I achieve my required result? Thanks.
use round
tp2 = find( tP == round(tP) );