Matlab :() Gah!
I need a Matlab function that finds the last place in a line where a double character appears (that is, where the same character appears twice in a row)
So if the function is called locateDouble, locateDouble('adcdccd') should return 5 since inxes 5 is the first charcter of the last double character.
I posted my attempt at the program below, but it won't work.
So if the function is called locateDouble, locateDouble('adcdccd') should return 5 since inxes 5 is the first charcter of the last double character.
I posted my attempt at the program below, but it won't work.
function double=locateDouble(line) place=length(line); while place>0; for j=1:length(line)-1; if j~==j+1 j=j+1 end end end<!-- google_ad_section_end -->
0
Comments
-drasnor
function double=findDouble(line)
place=length(line); (summary variable...start at end so it finds the last double)
while place>0; (goes until beginiing of line)
for j=length(line):1; (sets j values from the end of the line to the beginning)
if j~==j-1; (checks if j is not equal to the spot before it so it can move on if this is the case)
place=j-1; (sets it to the next place up in loop)
end
end
end
The problem it is giving is with the if...I can't figure out what to make that.