user3932000
user3932000

Reputation: 629

How to turn a string into a variable? (TI-84)

I'm trying to turn a string into a variable on my TI-84.

For example,

"XYZ"→Str0
fnInt(X²,sub(Str0,1,1),0,1)→A

But it's not letting me.

I know this seems like a really inefficient way of doing it (why not just do fnInt(X²,X,0,1)?), but in my program this would be very, very useful.

So is there a way to turn a string into a variable?

Upvotes: 3

Views: 606

Answers (2)

kamoroso94
kamoroso94

Reputation: 1735

I don't think you can use a string where fnInt( expects a variable. The only thing I can recommend is to use a bunch of if statements, using I as the index of the variable you're using from your string. Basically, you'd have to write out these cases explicitly, since there's no way to make a string get interpreted as a variable for that function.

If I=1:fnInt(X²,X,0,1)→A
If I=2:fnInt(X²,Y,0,1)→A
If I=3:fnInt(X²,Z,0,1)→A

Upvotes: 1

fuzzything44
fuzzything44

Reputation: 701

If you have a string as some function and want to evaluate it for some values, you can always store it to Y1, set the variables in it to what you want, and then just use Y1 as your evaluated function.

Upvotes: 1

Related Questions