Hi Everyone!
I keep getting the following error message for this line of the below code:
mat1[r,c] << this_record.chomp(",").strip()
I have been racking my brain but can't see a sollution - have used this line before so pretty baffled!!
Anyone got any ideas - would be very appreciated!
The error message is:
Error: private method `<<' called for 0.0:Float
HERE IS THE FULL CODE
mat1 = OtMatrix.new(19,649)
r = 0
c = 1
while ( !file.eof )
line = file.gets
r = r+1
line.each(',') { |this_record|
mat1[r,c] << this_record.chomp(",").strip()
c = c+1
if c == 19 then
c == 1
end
}
end
···
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by MailMarshal
#####################################################################################
You try to append the RHS to a float, which is what
mat1[r,c] evaluates to, that does not work of course.
It is difficult to fix the error because I do not know what you want to achieve
depending on the API of OtMatrix maybe the following would make sense
mat1[r] << RHS # adding an element to a row, however now you might
have an irregular matrix
mat1 << RHS # adding a new line at the end of the Matrix, is this what you want?
HTH
Robert
···
On 10/2/07, John Nott <JNott@dto.ie> wrote:
Hi Everyone!
I keep getting the following error message for this line of the below code: