Hi,
is this what you're looking for?
// path to the txt filepath = 'pathToFile'
// read the file as stringpiAsString = csvRead(path, [],['.'],'string')
// split the string at the decimal[piAsString] = strsplit(piAsString,'.');
// just get the digitspiDigits = strtod(strsplit(piAsString(2)));
// search: how often does appears a certain value in a specific range
within the digitssearchRange = 100;searchVal = 1;
[locations] = find(piDigits(1:searchRange) == searchVal);
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');
Best regards,
Philipp
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users