#NEWLINE# def FCparseMatlabSequence( s ) : #NEWLINE# #INDENT# if ( s . find ( ':' ) >= 0 ) : #NEWLINE# #INDENT# seq = s . split ( ':' ) #NEWLINE# if ( len ( seq ) == 2 ) : #NEWLINE# #INDENT# from_ = float ( seq [ 0 ] ) #NEWLINE# to = float ( seq [ 1 ] ) #NEWLINE# if ( step > to ) : #NEWLINE# #INDENT# raise Exception ( 'End of sequence should be less than start' ) #NEWLINE# #UNINDENT# result = [ ] #NEWLINE# while ( from_ <= to ) : #NEWLINE# #INDENT# result . append ( from_ ) #NEWLINE# from_ += 1 #NEWLINE# #UNINDENT# return result #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( seq ) == 3 ) : #NEWLINE# #INDENT# from_ = float ( seq [ 0 ] ) #NEWLINE# to = float ( seq [ 2 ] ) #NEWLINE# step = float ( seq [ 1 ] ) #NEWLINE# if ( from_ > to ) : #NEWLINE# #INDENT# raise Exception ( 'End of sequence should be less than start' ) #NEWLINE# #UNINDENT# if ( step <= 0 ) : #NEWLINE# #INDENT# raise Exception ( 'Step should be positive' ) #NEWLINE# #UNINDENT# result = [ ] #NEWLINE# while ( from_ <= to ) : #NEWLINE# #INDENT# result . append ( from_ ) #NEWLINE# from_ += step #NEWLINE# #UNINDENT# return result #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( seq ) > 3 ) : #NEWLINE# #INDENT# raise Exception ( 'Too many points in matlab notation' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( s . find ( ',' ) >= 0 ) : #NEWLINE# #INDENT# seq = s . split ( ',' ) #NEWLINE# result = [ ] #NEWLINE# for seq_i in seq : #NEWLINE# #INDENT# result . append ( float ( seq_i ) ) #NEWLINE# #UNINDENT# return result #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return [ float ( s ) ]