transcad Posted April 23, 2012 Posted April 23, 2012 Let's say have a lisp that use 4 variable - d11, d12, d13, d14. Instead of inserting 4 variable, i want to insert 1 single variable, like ... v1, and automatically to set all 4 variable d11, d12, d13, d14 . I don't know if is possible to do something like this by using an excel spreadsheet, where i have a table - for v1 a row with d11, d12, d13, d14.... and so on, for vn - dn1, dn2, dn3, dn4. Anybody has something similar as an example? Quote
MSasu Posted April 23, 2012 Posted April 23, 2012 Something like this? (setq index 1) (repeat 10 (set (read (strcat "D" (itoa index))) index) (princ (eval (read (strcat "D" (itoa index))))) (setq index (1+ index)) (princ "\n") ) Try to list the variables D1, D2 to D10 before and after run this example. Quote
Lee Mac Posted April 23, 2012 Posted April 23, 2012 I would strongly suggest using a list over numerous variables; after all, LISP is engineered specifically for LISt Processing... Quote
transcad Posted April 23, 2012 Author Posted April 23, 2012 This is what i found, and i want to use....http://lee-mac.com/readcsv.html In my "matrix", if i have m rows and n colomns, i want to set v11, v12..... v1n v21, v22 ....v2n ..................... vm1, vm2.....vmn help Quote
MSasu Posted April 23, 2012 Posted April 23, 2012 Since Lee Mac's solution is easier, you can construct a list like: ((v11 v12 ... v1n)(v21 v22 ... v2n) ... (vm1 vm2 ... vmn)) Just parse each line of said CSV file and build a list for the elements of that line; gather all those lists in a main one. To access items: (nth indexN (nth indexM MyMatrix)) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.