[Scilab-users] Read file (.txt)

Stefan Du Rietz sdr at durietz.se
Sat Sep 12 16:55:27 CEST 2020



On 2020-09-12 00:06, Stefan Du Rietz wrote:
> On 2020-09-11 19:32, Samuel Gougeon wrote:
>> Le 11/09/2020 à 16:51, Stefan Du Rietz a écrit :
>>> Hello Samuel,
>>>
>>> read() never works OK with m = -1, see your own comment in Bug 15075!
>>>
>>> This prevented me from upgrading to Scilab 6 until I found out how to 
>>> do it with fscanfMat(). But then I had to remove all blank lines in 
>>> my files (which I had to quickly find different parts of my data).
>>
>>
>> For me, it perfectly works for Daniel's file, with 6.0.2 as well as 
>> with 6.1.0.
>> May be the 15075's report could be retested and updated.
> 
> 
> With which OS? I am only using Linux (Ubuntu).
> 
> As a workaround, in Linux, you can quickly get the number of lines:
> --> m = evstr(strtok(unix_g("wc -l " + filename), " "));
> 
> I will add to the bug report.
> 
> /Stefan


That does not work if the file contains empty lines because the argument 
m to read() is the number of not empty lines to read! So one must 
subtract the number of empty lines from m above ...

Why on earth was read() changed from the excellent previous version to 
one of no use???



More information about the users mailing list