Combine Export and Local variables?
|
03-28-2022, 09:47 AM
(This post was last modified: 03-28-2022 09:48 AM by Amer7.)
Post: #1
|
|||
|
|||
Combine Export and Local variables?
Hello,
I have this matrix program. Idea: 1.) I will use default calculator matrix editor to input values into Matrix M1,M2,M3 2.) At the beginning of the program I want to use Input command to input a 2 variables. Their values are later used in the calculation in few places. Issue: I want to Export new Matrices ( N1,U1,Q1,D1,V1,L1, K1,K2, F1,S0,X1,K3,C1,C2,Q2,C3,Q3,Q4) so I could easily view their values in default calculator matrix editor. In past I have used this idea that you suggested, and it worked great. Code:
But now I don't know how to combine these two. Everything I've tried i get an error. Program that I want local to be exported Code:
And is there any way I could highlight In color this IF (K2==L1) THEN PRINT ("Kontrola 2 OK!"); If the K2 is equal to L1, and in red it it's not. ( printout in terminal) ? |
|||
03-28-2022, 10:20 AM
Post: #2
|
|||
|
|||
RE: Combine Export and Local variables?
(03-28-2022 09:47 AM)Amer7 Wrote: Hello, How does it know those local variables (N1,U1, etc.) are matrices unless you reserve space for them with MAKEMAT or MAKELIST? Tom L Cui bono? |
|||
03-28-2022, 10:48 AM
Post: #3
|
|||
|
|||
RE: Combine Export and Local variables?
Well I'm not sure, If the start value is Matrix, and if there are two operations with matrices it considers it automatically to be a matrix?
Code: //PROGRAM START When I used this code, I didn't reserve it with MAKEMAT or MAKELIST And the A1, and A2 matrices appeared in matrix editor with correct values |
|||
03-29-2022, 11:00 AM
(This post was last modified: 03-29-2022 11:02 AM by Amer7.)
Post: #4
|
|||
|
|||
RE: Combine Export and Local variables?
I have figured how to combine, It all works until the calculation between local and global variable.
Code:
The program returns 0, starting with Blolded part of the code- And that is not correct. |
|||
03-29-2022, 12:11 PM
Post: #5
|
|||
|
|||
RE: Combine Export and Local variables?
This line: X1=w2+D1;
should be this: X1:=w2+D1; -road |
|||
03-29-2022, 12:57 PM
Post: #6
|
|||
|
|||
RE: Combine Export and Local variables?
(03-29-2022 12:11 PM)roadrunner Wrote: This line: X1=w2+D1; Thank you road, I don't know how I didn't spot that. Is there a way that I could label the matrix in matrix editor? What I mean Can I somehow add text (description) Like Q3 is Matrix of average deviation of corrected measurements. Instead of having just Q3 and number of rows and columns |
|||
03-29-2022, 01:52 PM
Post: #7
|
|||
|
|||
RE: Combine Export and Local variables?
Did you try EDITMAT:
EDITMAT(Q3,"this is the title for Q3"); ? |
|||
03-29-2022, 02:11 PM
(This post was last modified: 03-29-2022 02:27 PM by Amer7.)
Post: #8
|
|||
|
|||
RE: Combine Export and Local variables?
(03-29-2022 01:52 PM)roadrunner Wrote: Did you try EDITMAT: Yes I have, but when I run the program it displays the Matrices with their titles, one by one. ( if i write EDITMAT for Q3, EDITMAT for Q4) (I've added the EDITMAT at the bottom of the program) Run program: Q3 with it's title ->OK ->Q4 with it's title ->OK-> Terminal But when I go to Matrix editor and click to view matrix Q3 there is no tittle. When I go Vars-User-Program Variables-Q3 It displays the matrix values in home. Is there any way simple way I could keep the Matrix with Title and their values for later viewing? And I have an issue when I clear the User variables, in matrix editor I still get matrices Q3, Q4... but empty (1,1) Edit: If it's complicated I will just return to using Local variable with EDIT MAT, and re-run program to see the value of the Matrix i need. |
|||
03-29-2022, 02:36 PM
Post: #9
|
|||
|
|||
RE: Combine Export and Local variables?
(03-29-2022 02:11 PM)Amer7 Wrote: Is there any way simple way I could keep the Matrix with Title and their values for later viewing? Not that i know of, at least not without writing a subroutine specifically for that; but someone else may know better. I also noticed some of your variable names are reserved names. Generally I try to avoid using reserved names in programs because it can sometimes cause issues. To avoid issues you can add a lower case letter to each variable name; for example: Uu1 instead of U1. -road |
|||
03-29-2022, 02:55 PM
Post: #10
|
|||
|
|||
RE: Combine Export and Local variables?
Thank you road, you guys really helped me write simple programs for this calculator.
I will implement the suggestion. Thank you! |
|||
04-11-2022, 09:58 AM
(This post was last modified: 04-11-2022 10:56 AM by Amer7.)
Post: #11
|
|||
|
|||
RE: Combine Export and Local variables?
Does anyone has an idea why the program crasher mid way with error
Invalid input INPUT({ff7,gg7},"Input test", {"Prekobrojnost","Sredina"}); Code:
Program crashes at Ss0, when viewing matrix via EDITMAT ff77=5 gg77=8.6667 EDIT- Some values wern't matrices Code: //PROGRAM START Now it works |
|||
04-12-2022, 07:09 AM
(This post was last modified: 04-12-2022 07:16 AM by Amer7.)
Post: #12
|
|||
|
|||
RE: Combine Export and Local variables?
I'm again having issues with this variation of program
Code:
Issue is on line 38 When ever I try to compute Vf1 with an Matrix it starts crashing with (input) problem Vf1= is Vf1:=Om1/ff7; ff7- is user input on start of the program I have tried making sure it's a matrix by M8:=Vf1(1,1); Again it crashes Cl1:=Vf1(1,1)*(inv(M2)); I've tried putting it in CAS("(Om1/ff7"); -Still doesnt work In my Edit mat Vf1 ( has only one element) And M2 is diagonal Matrix (4x4) Is there a way I assign the value of Vf1(1,1) to be a regular number so I could multiply the Matrix M2 without getting an issue? When I try to do I manually like in home: M2(1,1)*inv(M3) - I get correct numbers |
|||
04-12-2022, 05:18 PM
Post: #13
|
|||
|
|||
RE: Combine Export and Local variables?
A couple things i noticed:
First, I think this line: Cld2:=CAS("sqrt(Cld1)"); Should be this: Cld2:=CAS("sqrt(Cl1d)"); Second, In this line: LOCAL Cx1,Cl1,Ql1,Clk1,Qvk1,Cv1,SCx1; you declare variable Ql1 but I didn't see anywhere that is was assigned a value. It looks like you started to with this: //////Q= CL, but remed it out. When you declare a variable they start out at zero so at this line: Cl1:=Ql1*Vf1(1,1); Cl1 = 0*Vf1(1,1) which is zero. That causes this line: EDITMAT(Cl1,"Cl"); to flag an error. EDITMAT only works on matrix variables. |
|||
04-12-2022, 06:34 PM
Post: #14
|
|||
|
|||
RE: Combine Export and Local variables?
(04-12-2022 05:18 PM)roadrunner Wrote: A couple things i noticed: Wow, I really appreciate for spotting that mistake. Now it works. I really have to find some other program to write in, and I should start more like using names to be easier to spot the mistake. Thank you for your time to spot the mistake! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)