% Input: n1 e n2, due vettori di caratteri % Output: nome_out, unione di n1 e n2 senza ripetizioni function nome_out = unisci_nomi( n1 , n2 ) n = { split( n1 ) , split( n2 ) } ; if length(n{1}) >= length(n{2}) ; n_max = 1 ; else n_max = 2 ; end n_min = 3 - n_max ; for i_min = 1 : length(n{n_min}) new = true ; for i_max = 1 : length(n{n_max}) if strcmpi( n{n_min}{i_min} , n{n_max}{i_max} ) new = false ; break ; end end if new ; n{n_max} = [ n{n_max} ; n{n_min}{i_min} ] ; end end nome_out = join( n{n_max} ) ; nome_out = nome_out{1} ; end