selecting matixes based on a variable










4















Is there a way I can use a command that selects a matrix to use based on a variable?

Need in this /

:If (way to select a matrix based on what variable L equals) (E,F)=1:Output E,F,"O



I don't want to make a specific go-to for every single matrix I need.
This is for creating maps with the matrix in case anyone has a better way.










share|improve this question
























  • I don't think there's a way

    – Meepo
    Oct 28 '18 at 22:54











  • Maybe rethink using matrices in the way you are... Would it be possible to store your data in a different way? Possibly one matrix? The thing about TI-Basic as a whole is using a really crappy array of data types and methods to make something cool. I guess it would help us if you gave us more context about your problem so we could propose a different solution.

    – bearacuda13
    Nov 11 '18 at 18:00















4















Is there a way I can use a command that selects a matrix to use based on a variable?

Need in this /

:If (way to select a matrix based on what variable L equals) (E,F)=1:Output E,F,"O



I don't want to make a specific go-to for every single matrix I need.
This is for creating maps with the matrix in case anyone has a better way.










share|improve this question
























  • I don't think there's a way

    – Meepo
    Oct 28 '18 at 22:54











  • Maybe rethink using matrices in the way you are... Would it be possible to store your data in a different way? Possibly one matrix? The thing about TI-Basic as a whole is using a really crappy array of data types and methods to make something cool. I guess it would help us if you gave us more context about your problem so we could propose a different solution.

    – bearacuda13
    Nov 11 '18 at 18:00













4












4








4








Is there a way I can use a command that selects a matrix to use based on a variable?

Need in this /

:If (way to select a matrix based on what variable L equals) (E,F)=1:Output E,F,"O



I don't want to make a specific go-to for every single matrix I need.
This is for creating maps with the matrix in case anyone has a better way.










share|improve this question
















Is there a way I can use a command that selects a matrix to use based on a variable?

Need in this /

:If (way to select a matrix based on what variable L equals) (E,F)=1:Output E,F,"O



I don't want to make a specific go-to for every single matrix I need.
This is for creating maps with the matrix in case anyone has a better way.







ti-basic






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 29 '18 at 16:01









Dave2e

6,881112328




6,881112328










asked Oct 28 '18 at 17:24









xclamationxclamation

211




211












  • I don't think there's a way

    – Meepo
    Oct 28 '18 at 22:54











  • Maybe rethink using matrices in the way you are... Would it be possible to store your data in a different way? Possibly one matrix? The thing about TI-Basic as a whole is using a really crappy array of data types and methods to make something cool. I guess it would help us if you gave us more context about your problem so we could propose a different solution.

    – bearacuda13
    Nov 11 '18 at 18:00

















  • I don't think there's a way

    – Meepo
    Oct 28 '18 at 22:54











  • Maybe rethink using matrices in the way you are... Would it be possible to store your data in a different way? Possibly one matrix? The thing about TI-Basic as a whole is using a really crappy array of data types and methods to make something cool. I guess it would help us if you gave us more context about your problem so we could propose a different solution.

    – bearacuda13
    Nov 11 '18 at 18:00
















I don't think there's a way

– Meepo
Oct 28 '18 at 22:54





I don't think there's a way

– Meepo
Oct 28 '18 at 22:54













Maybe rethink using matrices in the way you are... Would it be possible to store your data in a different way? Possibly one matrix? The thing about TI-Basic as a whole is using a really crappy array of data types and methods to make something cool. I guess it would help us if you gave us more context about your problem so we could propose a different solution.

– bearacuda13
Nov 11 '18 at 18:00





Maybe rethink using matrices in the way you are... Would it be possible to store your data in a different way? Possibly one matrix? The thing about TI-Basic as a whole is using a really crappy array of data types and methods to make something cool. I guess it would help us if you gave us more context about your problem so we could propose a different solution.

– bearacuda13
Nov 11 '18 at 18:00












1 Answer
1






active

oldest

votes


















2














If i understand correctly you want to get the value from a certain matrix, chosen dynamically depending on the value of a variable. You can kinda do this by putting the names of the matrices into a string, then grab a substring of the string, using sub(, at a dynamic offset, based on L, and then feeding that string into expr( to get a reference to the matrix, ie



:"[A][B][C]"->Str1, sub(Str1,2,1) yields "[B]", expr("[B]") yields Matrix B...so 2 maps to [B]. TI considers the symbol [A] (and all the other matrix vars) to be a single character, so "[A][B][C]" is a 3 character string.



Note that all of the matrix vars need to be input from the MATRIX menu (including inside the string). Typing in the individual [ A ] chracters will not work.



Also note you can't grab indexes off of a matrix returned with expr (ie expr("[A]")(1,2) so you need an extra matrix (I used [J]) to store the result.



For example



:"MAKE SOME MATRICES"
:[[1,2][3,4]]->[A]
:[[5,6][7,8]]->[B]
:[[9,10],[11,12]]->[C]
:"SAMPLE L VALUE"
:2->L
:"STORE REFERENCES TO THE"
:"MATRICES IN A STRING"
:"[A][B][C]"->Str1
:expr(sub(Str1, L, 1))->[J]
:"SHOWS 6"
:[J](1,2)


so then proceed normally with [J]



:If [J](E,F)
: "DO WHATEVER


Tested on an 84 SE, I assume it would work the same for anything in that family, except IIRC some older models only have matrices A-F






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53034219%2fselecting-matixes-based-on-a-variable%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    If i understand correctly you want to get the value from a certain matrix, chosen dynamically depending on the value of a variable. You can kinda do this by putting the names of the matrices into a string, then grab a substring of the string, using sub(, at a dynamic offset, based on L, and then feeding that string into expr( to get a reference to the matrix, ie



    :"[A][B][C]"->Str1, sub(Str1,2,1) yields "[B]", expr("[B]") yields Matrix B...so 2 maps to [B]. TI considers the symbol [A] (and all the other matrix vars) to be a single character, so "[A][B][C]" is a 3 character string.



    Note that all of the matrix vars need to be input from the MATRIX menu (including inside the string). Typing in the individual [ A ] chracters will not work.



    Also note you can't grab indexes off of a matrix returned with expr (ie expr("[A]")(1,2) so you need an extra matrix (I used [J]) to store the result.



    For example



    :"MAKE SOME MATRICES"
    :[[1,2][3,4]]->[A]
    :[[5,6][7,8]]->[B]
    :[[9,10],[11,12]]->[C]
    :"SAMPLE L VALUE"
    :2->L
    :"STORE REFERENCES TO THE"
    :"MATRICES IN A STRING"
    :"[A][B][C]"->Str1
    :expr(sub(Str1, L, 1))->[J]
    :"SHOWS 6"
    :[J](1,2)


    so then proceed normally with [J]



    :If [J](E,F)
    : "DO WHATEVER


    Tested on an 84 SE, I assume it would work the same for anything in that family, except IIRC some older models only have matrices A-F






    share|improve this answer





























      2














      If i understand correctly you want to get the value from a certain matrix, chosen dynamically depending on the value of a variable. You can kinda do this by putting the names of the matrices into a string, then grab a substring of the string, using sub(, at a dynamic offset, based on L, and then feeding that string into expr( to get a reference to the matrix, ie



      :"[A][B][C]"->Str1, sub(Str1,2,1) yields "[B]", expr("[B]") yields Matrix B...so 2 maps to [B]. TI considers the symbol [A] (and all the other matrix vars) to be a single character, so "[A][B][C]" is a 3 character string.



      Note that all of the matrix vars need to be input from the MATRIX menu (including inside the string). Typing in the individual [ A ] chracters will not work.



      Also note you can't grab indexes off of a matrix returned with expr (ie expr("[A]")(1,2) so you need an extra matrix (I used [J]) to store the result.



      For example



      :"MAKE SOME MATRICES"
      :[[1,2][3,4]]->[A]
      :[[5,6][7,8]]->[B]
      :[[9,10],[11,12]]->[C]
      :"SAMPLE L VALUE"
      :2->L
      :"STORE REFERENCES TO THE"
      :"MATRICES IN A STRING"
      :"[A][B][C]"->Str1
      :expr(sub(Str1, L, 1))->[J]
      :"SHOWS 6"
      :[J](1,2)


      so then proceed normally with [J]



      :If [J](E,F)
      : "DO WHATEVER


      Tested on an 84 SE, I assume it would work the same for anything in that family, except IIRC some older models only have matrices A-F






      share|improve this answer



























        2












        2








        2







        If i understand correctly you want to get the value from a certain matrix, chosen dynamically depending on the value of a variable. You can kinda do this by putting the names of the matrices into a string, then grab a substring of the string, using sub(, at a dynamic offset, based on L, and then feeding that string into expr( to get a reference to the matrix, ie



        :"[A][B][C]"->Str1, sub(Str1,2,1) yields "[B]", expr("[B]") yields Matrix B...so 2 maps to [B]. TI considers the symbol [A] (and all the other matrix vars) to be a single character, so "[A][B][C]" is a 3 character string.



        Note that all of the matrix vars need to be input from the MATRIX menu (including inside the string). Typing in the individual [ A ] chracters will not work.



        Also note you can't grab indexes off of a matrix returned with expr (ie expr("[A]")(1,2) so you need an extra matrix (I used [J]) to store the result.



        For example



        :"MAKE SOME MATRICES"
        :[[1,2][3,4]]->[A]
        :[[5,6][7,8]]->[B]
        :[[9,10],[11,12]]->[C]
        :"SAMPLE L VALUE"
        :2->L
        :"STORE REFERENCES TO THE"
        :"MATRICES IN A STRING"
        :"[A][B][C]"->Str1
        :expr(sub(Str1, L, 1))->[J]
        :"SHOWS 6"
        :[J](1,2)


        so then proceed normally with [J]



        :If [J](E,F)
        : "DO WHATEVER


        Tested on an 84 SE, I assume it would work the same for anything in that family, except IIRC some older models only have matrices A-F






        share|improve this answer















        If i understand correctly you want to get the value from a certain matrix, chosen dynamically depending on the value of a variable. You can kinda do this by putting the names of the matrices into a string, then grab a substring of the string, using sub(, at a dynamic offset, based on L, and then feeding that string into expr( to get a reference to the matrix, ie



        :"[A][B][C]"->Str1, sub(Str1,2,1) yields "[B]", expr("[B]") yields Matrix B...so 2 maps to [B]. TI considers the symbol [A] (and all the other matrix vars) to be a single character, so "[A][B][C]" is a 3 character string.



        Note that all of the matrix vars need to be input from the MATRIX menu (including inside the string). Typing in the individual [ A ] chracters will not work.



        Also note you can't grab indexes off of a matrix returned with expr (ie expr("[A]")(1,2) so you need an extra matrix (I used [J]) to store the result.



        For example



        :"MAKE SOME MATRICES"
        :[[1,2][3,4]]->[A]
        :[[5,6][7,8]]->[B]
        :[[9,10],[11,12]]->[C]
        :"SAMPLE L VALUE"
        :2->L
        :"STORE REFERENCES TO THE"
        :"MATRICES IN A STRING"
        :"[A][B][C]"->Str1
        :expr(sub(Str1, L, 1))->[J]
        :"SHOWS 6"
        :[J](1,2)


        so then proceed normally with [J]



        :If [J](E,F)
        : "DO WHATEVER


        Tested on an 84 SE, I assume it would work the same for anything in that family, except IIRC some older models only have matrices A-F







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 30 '18 at 3:59

























        answered Nov 13 '18 at 23:02









        chiliNUTchiliNUT

        12.6k84678




        12.6k84678



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53034219%2fselecting-matixes-based-on-a-variable%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Barbados

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3