cancel
Showing results for 
Search instead for 
Did you mean: 
JKova
Level 4
140 93 2 5
Message 1 of 3
741
Flag Post

How to store any element of variable in FOR loop in the HP 50g graphing calculator

HP Recommended
HP 50g graphing calculator

Hello HP Community

I'm writing to you because I  expect to  give me an answer for these for me the hardest task for now.

I want to write more matrix than one in FOR loop but I also want to store every single matrix described in FOR loop with the different name , as the global variable , of course . So I don't know how to do this .

Problem is that , when I hit the following code (underneath) I get just one stored matrix of n numbered matrices  .

So, my screen  prints just last matrix entered in graphing calculator HP 50g .

 

Please help me anyone with this problem because I'm little getting mad , cause I don't know how to solve it , and I also don't know is it possible to solve it , any suggestions or solution will be great

 

This is following code :

 

(NOTE : this sign ---> represents an arrow to right direction )

 

<<"MATR"
{{ "a:" "" 0 }
 { "b:" "" 0 }
{ 1 2} { } 
DUP INFORM DROP OBJ--->
DROP  ---> a b
<< a b
FOR i { << #A2012h LIBEVAL>>}
1 DROP EVAL NEXT 'AB' STO
>>
>>

 

2 REPLIES 2
Jan_D
Level 6
305 297 32 76
Message 2 of 3
Flag Post
HP Recommended

In my opinion your program is more complex than needed for illustrating the problem.

I would suggest a simpler program:

 

<<  3 7 FOR i
    [0]  EDITB
    NEXT
>>

 This program puts 5 matrixes on the stack, but does not store them into variables.

I think the easiest way to store them into memory is to store them into a list.

This can be easily done by adding:

5    →LIST

 

The matrixes are now in the list, and we store the list as L1 by

'L1'   STO.

 

So now our program becomes:

 

<<  3 7 FOR i
    [0]  EDITB
    NEXT
    5 →LIST
    'L1' STO
>>

 When we next want the third matrix back we just have to write:

L1  3  GET

 

Was this reply helpful? Yes No
cyrille
Level 6
Level 6
252 251 42 78
Message 3 of 3
Flag Post
HP Recommended

Hello,

 

try a sequence among the lines of:

obj_to_store "var_name" count_variable + OBJ-> STO

the + will concactenate the counter varaible (1, 2, 3...) with the text "var_name". The OBJ-> will transform the string into a variable name that you can use for sto.

 

you migth (not sure) have to do "'var_name" count_variable + "'" +, but I am not sure.

 

Cyrille

I am an HP Employee
Was this reply helpful? Yes No
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation