Sorry, is ok , i have vectors ..
Paul

W dniu środa, 4 czerwca 2014 20:09:46 UTC+2 użytkownik paul analyst napisał:
>
> Big txh, it works,
> but now i heve 100 arrays (in real more... ) with 99 empty columns. Is 
> posible read m1 , m2  to vector , not to array ?
> Paul 
>
> W dniu środa, 4 czerwca 2014 19:22:11 UTC+2 użytkownik Bob Nnamtrop 
> napisał:
>>
>> Sorry I left out the function call:
>>
>> for i=1:100
>>     eval(parse("m$i = readcsv(\"m$i.txt\")"))
>> end
>>
>>
>>
>> On Wed, Jun 4, 2014 at 11:16 AM, Bob Nnamtrop <[email protected]> 
>> wrote:
>>
>>> Or closer to the syntax of the original loop:
>>>
>>> for i=1:100
>>>     eval(parse("m$i = \"m$i.txt\""))
>>> end
>>>
>>> Bob
>>>
>>>
>>>
>>> On Wed, Jun 4, 2014 at 11:13 AM, Patrick O'Leary <[email protected]> 
>>> wrote:
>>>
>>>> First, you probably would be better off with an array, rather than 100 
>>>> variables with numeric postfixes. You can use push!() for this.
>>>>
>>>> Second, the error is because Julia is trying to parse the left hand 
>>>> side as an attempt to define a function, using the shortened f(x) = y 
>>>> function definition syntax. Here, f is *, and the literal `"m" * 
>>>> string(i)` 
>>>> is being interpreted as the name of its argument, but this is not a valid 
>>>> identifier.
>>>>
>>>> Finally, although you almost certainly don't want to do what you're 
>>>> trying to do, you can if you separate creation of the symbol from 
>>>> evaluation:
>>>>
>>>> var_name = symbol("m" * string(i))
>>>> @eval $var_name = readcsv(string("m", i, ".txt"))
>>>>
>>>>
>>>> On Wednesday, June 4, 2014 11:36:37 AM UTC-5, paul analyst wrote:
>>>>>
>>>>> dynamic creation and naming of variables, what wrong?
>>>>>
>>>>> I need 100 new variables : m1 to m 100
>>>>>
>>>>> julia> for i=1:100
>>>>>        "m" * string(i)=readcsv(string("m",i,".txt"))
>>>>>        end
>>>>> ERROR: syntax: "#<julia_value>" is not a valid function argument name
>>>>>
>>>>
>>>
>>

Reply via email to