To talk on Icrontic, just register!

It only takes 30 seconds.

Have an account? Sign in:

Forgot?
freezingbum
New to the neighborhood
freezingbum
1 Posts

matlab help...distance/length

How do I find the distance between the two ones in this case?

M =

0
0
0
0
1
0
0
0
-1
0
0
0
1
0
0
0
-1
0
0
0


in this case the distance would be 8 but the number of zeros between will change...there will always be two 1's and two -1's..
shwaip
elaborate bot
shwaip
5,730 Posts
diff(find(a==1))

edit:

You should be able to write a for loop that calculates the difference, unless you really have no idea how to use matlab.
__________________ my photostream for ic photography challenge

Anyone who wants dropbox, please use my referral link
Similar Threads
Thread Thread Starter Forum Replies Last Post
Solving multiple equations using Matlab avi2112ben Matlab Help 3 22 Feb 2008 8:58pm
MatLab problem - inline function zero finder PGolasze Matlab Help 4 10 May 2007 12:38am
Need matlab help urgently shermaine Matlab Help 3 10 Nov 2006 1:00am
MATLAB code help please.... jennifer22cute Matlab Help 0 18 Sep 2006 8:53pm
MATLAB help= jpeg to avi dalisay Web & Digital Media 0 13 May 2006 5:03pm

Go Back   Icrontic Forums > Tech: Software > General Software > Matlab Help
Jump to
This Thread Search this Thread
Search this Thread:

Advanced Search


Current time: 10:16am (GMT)
Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Get Vanilla instead. Trust me.