1. consecutive numbers of data group(s) - MATLAB
2. Array of consecutive numbers with strings ?
Hi All, Sorry about the horrible subject title for this message. Say I have the following array.. 2 'word1' 5 'word2' 6 'word3' 7 'word4' 10 'word5' 14 'word6' 16 'word7' 17 'word8' 20 'word9' I want to leave numbers without consecutives as it is, but gorup numbers with consecutives into a cell array In other words, I want the following result 'word1' <3x1 cell> <-- which consists of word2 word3 and word4 'word5' 'word6' <2x1 cell> <-- which consists of word7 and word8 'word9' It will be great if you someone can help out. Thanks. Regards, Simon
3. finding consecutive numbers (runs) - MATLAB
4. Reading a formatted file: problem with consecutive numbers not separated by space
Hi all, I'm trying to read a formatted file. Each line looks like the following: 20061010 0 0.25130.10 4.05 3.72-99.00-99.00-99.00-99.00-99.00-99.00-99.00 1.76 -2.44 The format of the line, is: 1) a 4 digit integer 2) a 2 digit integer 3) a 2 digit integer then there is a space 4) a 2 digit integer then another space and then, from now on, all floating point numbers having 6digits fields with 2 digits after the dot. In FORTRAN: FORMAT(I4,I2,I2,1X,I2,1X,13F6.2) As you see, a problem exists because different fields are not always separated by a space(e.g. in the previous line the number 0.25 is not spearated from 130.10) I tried to use the following in matlab: fscanf(fid,'%4d%2d%2d %2d %6f%6f%6f%6f%6f%6f%6f%6f%6f%6f%6f%6f%6f\n',[17 inf]) but if I use the previous command, the 0.25 and the 130.10 re not separated. Instead, the fields are separated as 0.2513 and 0.10. I suppose I'm doing something wrong in the fields definition, but I tried other things (like %6.2f) withouth success... any idea why is it happening? How should I do? Bye, Gab
5. Consecutive Numbers ! - MATLAB
6. Generate consecutive binary numbers
How can I quickly generate a logical matrix of consecutive binary numbers from 1 to say 2^25? I also don't want to use too much memory. The way I do it now is:
logical(uint8(dec2bin(1:2^numc-1,numc)) - uint8('0'))
Can it be done better?
Thanks
7. consecutive series of numbers - MATLAB
8. what's the best way to find the number of consecutive blocks in
Dear Luna! > > > I want to find the length of longest consecutive stripe in that > > > column... You can find the indices of changes between the values with: Ind = find(diff(x)) Then you can find the number of elements between the changes with a further DIFF: Len = diff(Ind) Now [Num, MaxInd] = MAX(Len) gives the index and number of the longest sequence. *But* the marginal elements are not correctly considered now! Ind = [0; find(diff(x)); length(x)]; [LongestSeq, MaxInd] = max(diff(Ind)); LongestInd = Ind(MaxInd) + 1; (Please test this before using!) Good luck, Jan