HP Forums

Full Version: Printing Matrix from program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am currently having issues printing my matrix from my program. I made a matrix to hold tabulated steam data and while testing how its working I get an error. I dont understand very much as I tend to not use Matrices as much. I've tried: "Print(ST());", "Print(ST(1,1));", Print(ST{});", "Print(ST[]);", "Print(ST[1,1]);" and a few other things but I can't seem to get it to work.
Code:
//Steam Table
    export ST;
    export Steam_Table()
        begin
            
            ST:=[["Tempurature[C]","Liquid Enthalpy","Vapor Enthalpy"],[0.01,0,2501.4],[10,42.02,2519.2],[15,62.98,2528.4],[20,83.92,2537.5],[25,104.84,2546.5],[30,125.75,2555.6],[35,146.64,2564.6],[40,167.54,2573.5],[45,188.44,2582.5],[50,209.34,2591.3],[55,230.24,2600.1],[60,251.15,2608.8],[65,272.08,2617.5],[70,293.02,2626.1],[75,313.97,2634.6],[80,334.95,2643],[85,355.95,2651.3],[90,376.97,2695.5],[95,398.2,2667.6],[100,419.1,2675.6]];
            print(ST);

        end;
Bonjour

L'aide intégrée dit que PRINT affiche une expression ou une chaîne de caractères,
pour afficher une matrice utilisez EDITMAT.

Hello

The built-in help says that PRINT displays an expression or string,
to display a matrix use EDITMAT.
(10-09-2020 04:52 AM)Tyann Wrote: [ -> ]Bonjour

L'aide intégrée dit que PRINT affiche une expression ou une chaîne de caractères,
pour afficher une matrice utilisez EDITMAT.

Hello

The built-in help says that PRINT displays an expression or string,
to display a matrix use EDITMAT.

So I have never used the EDITMAT function before. I looked it up on the help to figure out how it works but am not sure and it did not print.

Je n'ai donc jamais utilisé la fonction EDITMAT auparavant. J'ai utilisé la fonction 'help' pour comprendre comment cela fonctionne mais je ne suis pas sûr et il ne s'est pas imprimé.
This is my current work-around. Since it wont let me print a matrix or really use a matrix I transposed it and made 3 lists for each row. This also helped me because I dont know how to call a column like you would a row. Since they are now in lists I can use the drop-down function in input to choose my desired Tempurature.

Code:

//Steam Table
    export ST_Temp:={"Tempurature[C]",0.01,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100};
    export ST_Liq_Enthalpy:={"Liquid Enthalpy",0,42.02,62.98,83.92,104.84,125.75,146.64,167.54,188.44,209.34,230.24,251.15,272​.08,293.02,313.97,334.95,355.95,376.97,398.2,419.1};
    export ST_Vap_Enthalpy:={"Vapor Enthalpy",2501.4,2519.2,2528.4,2537.5,2546.5,2555.6,2564.6,2573.5,2582.5,2591.3,2600.1,26​08.8,2617.5,2626.1,2634.6,2643,2651.3,2695.5,2667.6,2675.6};
    
    export Steam_Table()
        begin
            print();
            local Sat_Temp;
            Input({{Sat_Temp,ST_Temp,{50,40,2}}});
            print("Liquid Enthalpy "+ST_Liq_Enthalpy(Sat_Temp));Print("Vapor Enthalpy "+ST_Vap_Enthalpy(Sat_Temp));
        end;

I still wish I could use a matrix instead of multiple lists. If anyone can help it would be much appreciated.
Matrix are mathematical objects, you’re not allowed to insert strings.
Once the strings removed you should be able to use EDITMAT.

Unfortunately the “title” or the {“title”, { “title row”...}, {“title col”}} does not seem to work, but the Boolean flag ‘readonly’ works well.

Code:

EXPORT MATTEST()
BEGIN
 LOCAL MAT1 := [[1.1,1.2,1.3],[2.1,2.2,2.3],[3.1,3.2,3.3]];
 EDITMAT(MAT1, "MYMAT", 1);
END;

Using EDITLIST doesn’t work on list of lists, and the “title” is also ignored, or I missed something to use it.
Reference URL's