[Cmpl] Fwd: bug with readcsv

Mike Steglich mike.steglich at th-wildau.de
Mon Apr 22 13:33:52 EDT 2013


Anfang der weitergeleiteten E-Mail:

> Von: Mike Steglich <mike.steglich at th-wildau.de>
> Betreff: Re: [Cmpl] bug with readcsv
> Datum: 22. April 2013 17:53:39 MESZ
> An: Bastian Dörig <Bastian_D at hotmail.de>
> 
> Hello Bastian,
> 
> It seems that an old bug is appearing again. The \r\n at the end of the first line is interpreted as two new line feeds. This error should only appear at Windows. 
> 
> It will be fixed in the next release.
> 
> In the meantime I would like to suggest to use a cmplData file.
> 
> test.cdat
> ########
> rows set < 1..2>
> cols set <1..2>
> E[rows,cols] < 10 2999
> 			10 299>
> ######
> 
> test.cmpl
> ###########
> %data test.cdat: rows set, cols set, E[rows,cols]
> 
> parameters:
> 	echo count(E[,1]);
> 	echo E[1,1];
> 	echo E[1,2];
> 	echo E[2,1];
> 	echo E[2,2];
> 	#echo E[3,1];
> 	#echo E[3,2];
> 
> ....
> ######
> 
> 
> Thanks,
> 
> Mike
> 
> 
> 
> 
> Am 22.04.2013 um 15:47 schrieb Bastian Dörig:
> 
>> Hello,
>> 
>> I've found a bug with readcsv and don't know how to fix it.
>> I want to import a matrix from a csv file.
>> The csv file "test.csv":
>> 10;29999
>> 10;299
>> 
>> and my cmpl file is:
>> 
>> parameters:
>> E[,] := readcsv("test.csv");
>> echo count(E[,1]);
>> echo E[1,1];
>> echo E[1,2];
>> echo E[2,1];
>> echo E[2,2];
>> echo E[3,1];
>> echo E[3,2];
>> 
>> with the output:
>> 3 (the file contains only 2 rows, here's the first mistake)
>> 10 (correct)
>> 29999 (correct)
>> 9999 (this are the last 4 digits of the last number in the first row)
>> error (interpreter): file test.cmpl line7: Parameter E[2,2] is not defined
>> 1 (I think this belongs to the error above)
>> 10 (correct)
>> 299 (correct)
>> 
>> 
>> to sum up:
>> 
>> 10;29999
>> 10;299
>> is made to
>> 10;29999
>> 9999
>> 10;299
>> 
>> the last digits of a row are put into a new row. If the csv file consists of 3 rows, there will be 5 rows after the import. It doesn't depend on the length of the rows.
>> 
>> 
>> It would be nice if you could help me.
>> 
>> regrads,
>> Bastian Dörig
>> 
>> _______________________________________________
>> Cmpl mailing list
>> Cmpl at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/cmpl
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cmpl/attachments/20130422/bb2c7ed1/attachment.html>


More information about the Cmpl mailing list