[Scilab-users] ?= ?==?utf-8?q? e
Chin Luh Tan
chinluh.tan at bytecode-asia.com
Wed Feb 12 17:02:47 CET 2020
to add on, it might not just affect csvRead, but also others file IO functions as well:
how to reproduce:
// Not OK
a = ones(1,300000);
b = strcat(string(a));
mputl(b,'test.txt');
c = mgetl('test.txt');
then a is 250,000 mgetl get the string correctly, but when a is 300,000, it return empty string.
on the other hand, file in single column of data working fine.
// OK
a = ones(1,300000);
b = string(a);
mputl(b,'test.txt');
c = mgetl('test.txt');
thanks.
rgds,
CL
---- On Wed, 12 Feb 2020 23:40:45 +0800 arctica1963 <arctica1963 at gmail.com> wrote ----
PI250KDP.TXT <http://mailinglists.scilab.org/file/t495709/PI250KDP.TXT>
PI500KDP.TXT <http://mailinglists.scilab.org/file/t495709/PI500KDP.TXT>
clear
// path to the txt file
path = 'PI250KDP.txt'
// read the file as string
piAsString = csvRead(path, [],[],'string')
// split the string at '' (use no token)
[piAsString] = strsplit(piAsString,'');
// convert string to double
piDigits = strtod(piAsString);
// search: how often appears a certain value in a specific range within the
digits
searchRange = 10000;
searchVal = 1;
// adapt the range, to search only places behind the decimal sign
[locations] = find(piDigits(1:searchRange+1) == searchVal); // small tweak
here
printf("The number %d appears %d times in the first %d digits of
Pi\n",searchVal,length(locations),searchRange) ;
printf("The number %d appears at following locations: \n", searchVal);
disp(locations');
The 250K file works; the 500k file fails
--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
mailto:users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200213/11c4292c/attachment.htm>
More information about the users
mailing list