MATLAB: Where is the zero vectors How to find the location of a zero (or a different number) in a vector ? like : a=[ 1 3 5 6 34 4 0 1 3 4 50]=>7 Best Answer a=[ 1 3 5 6 34 4 0 1 3 4 50]index=find(a==0) Related SolutionsMATLAB: How to fill in zeros with values from another vector a = [1 2 0 0 3 0 5]; %EDITEDb = [4 3 2];a(a==0)=b MATLAB: How to find a vector’s location in another vector The simplest and most efficient solution is to use strfind:>> a = [1,2,3,4];>> A = [0,4,2,3,1,2,3,5,1,2,3,4,5,6];>> strfind(char(A),char(a)) % or just strfind(A,a)ans = 9 Related QuestionCopy one matrix into anotherHow to find out the location difference of nonzero entries in two sparse matricesHow to run the loop 50 times and store the outputsFinding maximum number location in a matrixFind dublicated value in a column and return the whole rowHow to find these rows in a dataset directly before a sequence of NaNsHow to write a fucntion which we don’t know how many “in” values will be needed
Best Answer