[scilab-Users] Looking for a function
Sébastien Bihorel
pomchip at free.fr
Fri Feb 12 15:19:41 CET 2010
Thanks Mathieu,
You confirm what I suspected. I would to build the function myself, using a
code similar to yours but recursive... Not a big deal, though.
Sebastien
On Fri, Feb 12, 2010 at 3:21 AM, Mathieu Dubois <mathieu.dubois at limsi.fr>wrote:
> Hello Sébastien,
>
> Thanks to Gianluca I gave a second look to your message.
>
> I think that mlist and function overloading fit your needs (see attachment
> and scilab's help).
>
> Please note that I'm not an expert in scilab's mlist so this code comes "as
> is" with no express or implied warranty for accuracy or accessibility, blah,
> blah, blah,...
>
> HTH,
> Mathieu
>
> Sébastien Bihorel wrote:
>
>> Hello,
>>
>> I was wondering if there is a function in Scilab that allows to display
>> lists in a compact way rather than as a (sometime endless) listing. I did
>> not see any link to such function in 'help list'. For those of you who are
>> familiar in the R language, I am looking for something like the 'str'
>> function, as exemplified below:
>>
>> > mylist<-list(a=list(abc=1:10,xyz=letters[1:15]),
>> elem=matrix(1:10,ncol=2))
>> > mylist
>> $a
>> $a$abc
>> [1] 1 2 3 4 5 6 7 8 9 10
>>
>> $a$xyz
>> [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o"
>>
>>
>> $elem
>> [,1] [,2]
>> [1,] 1 6
>> [2,] 2 7
>> [3,] 3 8
>> [4,] 4 9
>> [5,] 5 10
>>
>> > str(mylist)
>> List of 2
>> $ a :List of 2
>> ..$ abc: int [1:10] 1 2 3 4 5 6 7 8 9 10
>> ..$ xyz: chr [1:15] "a" "b" "c" "d" ...
>> $ elem: int [1:5, 1:2] 1 2 3 4 5 6 7 8 9 10
>>
>>
>> Thanks
>>
>> Sebastien
>>
>
>
> // R syntax
> //mylist<-list(a=list(abc=1:10,xyz=letters[1:15]),
> // elem=matrix(1:10,ncol=2))
>
> clc;
> clear;
>
> mylist=mlist(['V', 'a', 'xyz', 'elem'], 1:10, 'a':'o', matrix(1:10,
> [5,2]));
>
> typeof(mylist)
>
> //define display
> function []=%V_p(M)
> disp('Hello I''m an overloaded function');
> disp('Field a is');
> disp(string(M.a));
> disp('Field xyz is');
> disp(string(M.xyz));
> disp('Field elem is')
> disp(string(M.elem));
> endfunction
>
> mylist
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100212/fd0f2522/attachment.htm>
More information about the users
mailing list