Or: 

maximum([t.tau_max for t in TUnitS])


On Thursday, May 7, 2015 at 12:02:09 PM UTC-4, Darwin Darakananda wrote:
>
> How about :
>
> mapreduce(t -> t.tau_max, max, TUnitS)
>
>
> On Thursday, May 7, 2015 at 8:49:49 AM UTC-7, Michela Di Lullo wrote:
>>
>> Hello everyone, 
>>
>> I have to compute the maximum value of tau_max, attribute of TUnit which 
>> is declared as follows:
>>
>> immutable TUnit
>>
>>     Node::Int16
>>
>>     a::Float64
>>
>>     b::Float64
>>
>>     c::Float64
>>
>>     inf::Float64
>>
>>     sup::Float64
>>
>>     ton::Int16
>>
>>     toff::Int16
>>
>>     storia0::Int16
>>
>>     pt0::Float64
>>
>>     rampa_up::Float64
>>
>>     rampa_dwn::Float64
>>
>>     rampa_up_str::Float64
>>
>>     rampa_dwn_str::Float64
>>
>>     SUC_C::Float64
>>
>>     tau_max::Int16
>>
>> end    
>>
>>
>> TUnitS = Array(TUnit,size(generators,1))
>>
>>
>> for j in 1:size(generators,1)
>>
>>     #println(generators[j,1:end])
>>
>>     #FL:This call the contructor, see all the discussion in the manual 
>> "Parametric Constructors" section
>>
>>     #to understand the whole (complex story) of the syntax with "..."
>>
>>     TUnitS[j]   = TUnit(generators[j,1:end]...)
>>
>>     println("TUnit = ", j, "\t Node[$j]= ", TUnitS[j].Node, "\t a[$j] = 
>> ", TUnitS[j].a, "\t ...", "\t tau_max[$j] = ", TUnitS[j].tau_max)
>>
>> end
>>
>>
>> I tried with both maximum(TUnitS.tau_max) and maximum(TUnitS[j].tau_max, 
>> j=[1:gmax]), but it doesn't work..
>>
>>
>> Any idea about how to make it? 
>>
>>
>> Thank you very much for any suggestion,
>>
>>
>> Michela
>>
>

Reply via email to