12-16-2006 06:42 PM
I need a way to identify if a number is a prime. Are there any inbuilt functions such as the matlab Boolean “isprime(X)” or a simple way to use matlab with labview?
12-16-2006 09:31 PM
12-17-2006 11:23 AM - edited 12-17-2006 11:23 AM
Message Edited by altenbach on 12-17-2006 09:24 AM
01-11-2007 10:31 AM - edited 01-11-2007 10:31 AM
Message Edited by GerdW on 01-11-2007 05:34 PM
01-11-2007 11:17 AM - edited 01-11-2007 11:17 AM
Don't forget to wire the error-out for the mathscript node. It will let you know if you exceed the valid range.
For example, If I enter 140737488355333, an error occurs (Code -90001: Error in function isprime at line 1. A problem occurred in a subVI call.).
(Clearly, for large primes you'll need something along the lines of the winning entry of the prime challenge. ;))
Do you know if the matlab isprime() function has the same restriction? From the matlab help, it says "A must contain only positive integers" so I guess it has the same problem.
Message Edited by altenbach on 01-11-2007 09:20 AM
01-11-2007 11:33 AM
01-12-2007 02:42 AM - edited 01-12-2007 02:42 AM
Message Edited by GerdW on 01-12-2007 09:51 AM
07-25-2007 11:15 AM - edited 07-25-2007 11:15 AM
Message Edited by God's Templar on 07-25-2007 11:17 AM
07-26-2007 02:09 AM
07-26-2007 08:51 AM - edited 07-26-2007 08:51 AM
Message Edited by altenbach on 07-26-2007 06:53 AM