Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Data Structures > getfield

getfield

list field extraction

Syntax

[x,...] = getfield(i,l)

Arguments

x

matrix of any possible types.

l

list, tlist or mlist variable.

i

field index, see extraction for more details.

Description

This function is an equivalent of [x,...]=l(i) syntax for field extraction with the only difference that it also applies to mlist objects.

Examples

l = list(1,'qwerw',%s)
[a,b] = getfield([3 2],l)

// Rationals are encoded as t-lists:
r = [%z/(1-%z) %z^2/(1+%z)]
type(r)
[num, den] = getfield([2 3],r)

// Structures arrays are encoded as M-lists:
s.r = %pi
s.b = %t
s.t = "Scilab"
s(2).t = "Basile"
getfield(2,s)==size(s)
getfield(1,s)(3:5)==fieldnames(s)'
[r,b,t] = getfield([3 4 5],s)

See also

Report an issue
<< fieldnames Data Structures isfield >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:49:21 CET 2020