Post Reply 
Editing matrix in a program: not updating issue
03-17-2015, 09:15 PM (This post was last modified: 03-17-2015 09:17 PM by salvomic.)
Post: #1
Editing matrix in a program: not updating issue
hi,
perhaps I'm using in wrong mode my code, but in my new program for ANOVA two factors I'm searching to editing a matrix (anovamat) trying to get two goals: if the matrix is already set then use it; if not, input a new one.
My programs seems to work but after the first run it use the old data and sure I'm setting variables in a wrong mode. I use something like that with reals and it works, resetting values of variables at every running, but not here...

The whole program is here.

See:
Code:

export anovamat:=[[0,0],[0,0]];
...
export anova_dfreedom2:={0,0,0,0};

EXPORT ANOVA2()
BEGIN
local a, ...
...
EDITMAT(anovamat);
sto(anovamat, anovamat);
...

I'm searching also a mode to set export to get a generic matrix without precise setting for rows and cols in
export anovamat ...

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
03-18-2015, 07:24 AM
Post: #2
RE: Editing matrix in a program: not updating issue
Hello,

Not sure that I understand what you want to do, but

editmat(anovamat), assuming that anovamat is a matrix should edit it. If the user pressed OK at the end, then the value of anovamat should change. If the user presses CANCEL, then it will stay unchanged...

There is no need for the sto underneath...

Since anovamat is a global variable of your program, and assuming that you do not edit the program in between 2 runs (which will reset anovamat), the value of anovamat should stay the same between 2 runs (unless you override it later in your program)...

If you want a 'new' anovamat each run, then you would need to either reset it manually at each run, OR declare it as a local variable.

Cyrille
Find all posts by this user
Quote this message in a reply
03-18-2015, 08:41 AM
Post: #3
RE: Editing matrix in a program: not updating issue
(03-18-2015 07:24 AM)cyrille de brébisson Wrote:  Since anovamat is a global variable of your program, and assuming that you do not edit the program in between 2 runs (which will reset anovamat), the value of anovamat should stay the same between 2 runs (unless you override it later in your program)...

If you want a 'new' anovamat each run, then you would need to either reset it manually at each run, OR declare it as a local variable.

Cyrille

Hello,
I don't want another matrix, only that.
What happen if the user press "Enter" instead of OK? I'm trying this...

However after some tries with CAS and Home, in Matrix Editor I saw two matrix: anovamat and anovamat (CAS)...

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
03-19-2015, 06:53 AM
Post: #4
RE: Editing matrix in a program: not updating issue
ENTER and OK, ESC and CANCEL are equivalents.

The Cas namespace is different from the home namespace, even if efforts have been made to merge them, they are for all intend and purposes separated internally.

In your case, you managed to create 2 variables with the same name in the 2 domains. it's actually not that hard to do.
Create the cas version first
then declare the home version as a program exported variable.

Anyhow, try to avoid mixing CAS and non CAS stuff if you can as it tend to lead to troubles.

Good luck

Cyrille
Find all posts by this user
Quote this message in a reply
03-19-2015, 10:10 AM
Post: #5
RE: Editing matrix in a program: not updating issue
(03-19-2015 06:53 AM)cyrille de brébisson Wrote:  In your case, you managed to create 2 variables with the same name in the 2 domains. it's actually not that hard to do.
Create the cas version first
then declare the home version as a program exported variable.

hi Cyrille,
I created also the exported variable, to let user edit matrix both inside and outside the program, and I'd like the program could be used in CAS and in Home (and it seems so).
A few times I got the problem with updating of the matrix but now I cannot reproduce the issue (I'm trying other times)...
However the program generally is ok.
I noted also that if I change something in the program and save, the matrix will be reset. But, indeed, one doesn't change things in a program every day Smile

ciao
Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
03-20-2015, 06:48 AM
Post: #6
RE: Editing matrix in a program: not updating issue
Hello

>I noted also that if I change something in the program and save, the matrix will be reset. But, indeed, one doesn't change things in a program every day

Yes, this is normal and intended.
All the Program global variables will be deleted when the program is changed (after all, it is very possible that editing the program will cause some of these variables to be erased and new ones created).
Then, upon suxesfull compilation of the program, the variables are created and initialized at the specified value.

cyrille
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)