Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

I need a function that removes scalar values of zero along a vector.

조회 수: 1 (최근 30일)
Joshua
Joshua 2013년 11월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello, my name is Josh. I am working on some personal research in numbers, and I am using your MATLAB language to do so. I have an extremely long vector, one that I have to put a semicolon after just to not have my command window go bazonkers. It is a one step vector from one to one billion. I am then using the mod function to figure out how many of these numbers, from one to one billion, are divisible by a certain number. I then want to "lay the vectors side by side" and for every zero in the mod vector, I want to remove the corresponding column in the other vector. God, I hope that makes sense. Right now I only have the two vectors, the "X" vector and the mod vector.

답변 (2개)

Marc
Marc 2013년 11월 19일
You could use I= find(ne(a,o)) or logical indexing should work....
bMod = b(ne(a,o))..... I think this would work. Need to check

Matt J
Matt J 2013년 11월 19일
X=X(mod(X,n)~=0);

이 질문은 마감되었습니다.

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by