[Gretl-users] saving the row/col names of a matrix

artur bala artur.bala at laposte.net
Tue Nov 1 14:34:53 EDT 2011


> On Tue, 25 Oct 2011, artur bala wrote:
>
>> Could it be possible to save the row/col names that one may give to a
>> matrix ?
> I'm not sure what you mean. If the row or column names are put
> in a named string variable they're automatically saved.
>
> matrix m = I(3)
> string cnames = "name1 name2 name3"
> colnames(m, cnames)
> print m
> print cnames
Another point (which was my original one): the names are not saved when 
a matrix is returned from a function.
If I transform your script into a function, and call it from a script 
the saved matrix has no row/col saved.

function matrix nothing (scalar value)
   m = I(value)
   if value = 3
     string cnames = "name1 name2 name3"
     string rnames = "name4 name5 name6"
     colnames(m, cnames)
     rownames(m, rnames)
     print m
   endif
   return m
end function

best,
artur


More information about the Gretl-users mailing list