selecting matixes based on a variable
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
add a comment |
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
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
add a comment |
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
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
ti-basic
edited Oct 29 '18 at 16:01
Dave2e
7,186112428
7,186112428
asked Oct 28 '18 at 17:24
xclamationxclamation
211
211
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
add a comment |
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
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
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
edited Nov 30 '18 at 3:59
answered Nov 13 '18 at 23:02
chiliNUTchiliNUT
12.7k94879
12.7k94879
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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