Linked Questions

3 votes
2 answers

Is it possible to set values for a list of variables using a for loop? [duplicate]

Let me preface this question by noting that this is a simple example meant to clarify what I am asking. The actual context in which I want to implement this involves associations containing hundreds ...
user63017's user avatar
  • 117
2 votes
3 answers

How can I assign many values each to a different variable? [duplicate]

How can I assign many values each to a different variable? For example, I want to set $a = f(1),\,b = f(2),\,c = f(3),\,\dots,\,z = f(26)$ (generally more variables than these). How can I do this ...
user41614's user avatar
  • 161
3 votes
2 answers

Convert Strings in Variables [duplicate]

I want to convert strings to variables. I want to create the term pionprodg1. I tried to do this: ...
Andre Luiz MB's user avatar
0 votes
1 answer

Assign a value to the protected string [duplicate]

How can I assign a value for a symbol composed of a string plus and another string converted from integer? n=3; Symbol["as"<>ToString[n]]=4; So I want to ...
user16308's user avatar
1 vote
3 answers

How to set a value to the symbol denoted by a given string? [duplicate]

The code setString[name_String, value_]:= Evaluate[Symbol[name]] = value fails whenever Symbol[name] has already been assigned ...
user3257842's user avatar
3 votes
2 answers

How to convert a list of names and values into a series of expressions [duplicate]

I had an Excel spreadsheet with a list of symbols names in the first column and a list of values in the second column. I imported it. Working with the resulting expression, I now have (in Mathematica) ...
Gene Naden's user avatar
4 votes
0 answers

How to get Symbol["x"]=3 to work [duplicate]

This is probably a really simple one, but I'm stumped. I want Symbol["x"]=3 to work just like x=3. However I can't figure out ...
Mark Adler's user avatar
  • 4,939
0 votes
0 answers

Can you dynamically create variable names in Mathematica? [duplicate]

I was wondering if there is a way of Mathematica to read a string or number and create variable with that name. For instance imagine that I have a file with the word data1. I would want to create a ...
Granger Obliviate's user avatar
0 votes
0 answers

Transform String to Expression [duplicate]

I have a variable postVector and another called CHKpostVector. Both are global variables. Only the variable ...
Rby's user avatar
  • 159
1 vote
1 answer

InputField with a symbol’s name [duplicate]

Suppose I have an InputField of type String wherein I want to enter a symbol name that I want a later Button to assign values to. That button would then do something like: ...
Kevin Ausman's user avatar
  • 2,267
2 votes
0 answers

Import names into notebook namespace [duplicate]

I have function that at some point has list of strings (e.g. {"apple","pear"}) and I want to declare (initialize) those variables in notebook namespace to default ...
Bruno Cuc's user avatar
0 votes
0 answers

Symbol created in Module not seen outside of Module scope [duplicate]

I am using a function defined with a Module[]. In the Module I am creating a new variable name using a ...
brnady's user avatar
  • 1
0 votes
0 answers

Performing operations on LHS of assignment [duplicate]

Is it possible to first perform an operation on LHS of the = symbol, evaluate that, and then assign the RHS to the new LHS as usual? The following shows the most ...
Alexandre Lopez's user avatar
0 votes
0 answers

Evaluating a String that is a Variable [duplicate]

I have a Variable assigned a value, say ImportantDocuments=1 How do I make N["ImportantDocuments"] evaluate to be 1 instead of ImportantDocuments I found that N[ToExpression["...
user2019001's user avatar
0 votes
0 answers

How can I create a variable named from a concatenation of strings and assign it a value created similarly? [duplicate]

I have got a list of strings, a = {"first","second","third"}. For each of those strings I would like to create a variable called "The" followed by its content, so ...
user avatar

15 30 50 per page