how to pick out postion in a vector

3 次查看(过去 30 天)
Christopher
Christopher 2013-5-10
Hey guys, I have a vector a= [ 1,0,8,0,5,0,3,0,6,9] I want to run a for loop like this for p=1:length(a) if a ==0 spit out where in vector a the zeros are located end end Thanks

回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-5-10
编辑:Azzi Abdelmalek 2013-5-10
a= [ 1,0,8,0,5,0,3,0,6,9]
idx=find(~a)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by