HP Forums

Full Version: Control (programmatically) if a list exist, otherwise create it
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi all,
what's the simplest way to control (programmatically) if a list exist, otherwise create it (then edit it with EDITLIST)?

thank you
Salvo
(05-18-2015 04:10 PM)salvomic Wrote: [ -> ]hi all,
what's the simplest way to control (programmatically) if a list exist, otherwise create it (then edit it with EDITLIST)?

thank you
Salvo

Hi Salvo,
Maybe you can use the length command to determine if a list is already created.

Code:

IF length(L1)==0 THEN
...
ELSE
...
END;

Just a tricky idea.
(05-18-2015 05:14 PM)mandresve Wrote: [ -> ]
Code:

IF length(L1)==0 THEN
...
ELSE
...
END;

Just a tricky idea.

thank you,
I'm trying with variable flows (program for IRR): if flows doesn't exist my program gives "Error:unlatch control word" ... I dunno what it means...

Salvo
Hello,

look at the TYPE and SIZE commands to test if a varaible is a list (type 6) and it's size.

use Solve.SOLVE rather than fsolve for the solving of the IRR, it probably will work better in this case as it will not call the CAS.

cyrille
(05-19-2015 05:23 AM)cyrille de brébisson Wrote: [ -> ]Hello,
look at the TYPE and SIZE commands to test if a varaible is a list (type 6) and it's size.
use Solve.SOLVE rather than fsolve for the solving of the IRR, it probably will work better in this case as it will not call the CAS.
cyrille

thank you, Merci, Cyrille,
I'll try it this evening at home. If it works I'll be able to avoid to call CAS and could solve two problem in few rows of code.

Salvo

EDIT: however now I'm trying with solve() and not fsolve() and it works better also with the "11 element list" (2 results, but the first, the negative one has -1 added...), however in CAS Terminal gives the message "Warning, argument is not an equation, solving ...", in Home no message.

Instead, Solve.SOLVE() works in Home and CAS, but gives only one result...

Much better, however!
Reference URL's