Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.4K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to assign numerical values to a list of strings?

Posted 12 years ago

(*I am a novice in Mathematica,and am finding a hard time in \ associating numerical values with a list of strings.Here is what I \ have been trying to do:*) list = ReadList[ "file path", Word, WordSeparators -> {","}];

(the list is a single column of several multi-character variables) cLength = Length[list]; cLength For[i = 1, i < cLength, i++, Keys[<|list[[i]] -> (0.0 + 0.005*i)|>]; Print[list[[i]]]]; x = 1; y = 2; x y

(* I get the below. While assigning "1" to x, and "2" to y, gives the correct association, The code above does not assign the numerical values to variable1 and variable2 as instructed in the "For" loop)

177

variable1 variable2 .... 1 2

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard
Be respectful. Review our Community Guidelines to understand your role and responsibilities. Community Terms of Use