[Scilab-users] [EXTERNAL] Count specific values in text file
Chin Luh Tan
chinluh.tan at bytecode-asia.com
Wed Feb 12 09:35:47 CET 2020
Hi,
tabul function might help.
sample data download from https://thestarman.pcministry.com/math/pi/picalcs.htm
unzip the https://thestarman.pcministry.com/math/pi/df/pimultdp.zip
following lines do the "counting" job.
have not tried the millions decimal places, good luck.
--> data = mgetl('PI25K_DP.TXT');
--> data2=strsplit(data);
--> tabul(data2)
ans =
ans(1)
!9 !
! !
!8 !
! !
!7 !
! !
!6 !
! !
!5 !
! !
!4 !
! !
!3 !
! !
!2 !
! !
!1 !
! !
!0 !
ans(2)
2509.
2465.
2480.
2541.
2567.
2549.
2491.
2403.
2519.
2476.
---- On Wed, 12 Feb 2020 15:57:23 +0800 arctica1963 <arctica1963 at gmail.com> wrote ----
Hello Philipp
Your suggestion is kind of what I am trying to do, but the text file is not
a CSV structure. It is just a single, very big number on one row. A small
chunk:
31415926535897932384626433832795028841971693993751058209749445923078164 etc
(no spaces between digits)
How best to load the text file and then count the number of occurrences of a
specific digit (e.g. 1)? At the moment the file essentially contains a very
big integer.
Interested to see the best method of doing this.
Thanks
--
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/20200212/665770c3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smile.png
Type: image/png
Size: 1470 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20200212/665770c3/attachment.png>
More information about the users
mailing list