Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.1.0 - Français


rmfield

Remove fields from a struct

Syntax

stout = rmfield(stin, fields)

Arguments

stin

A struct variable.

fields

String matrix or cell of strings, the names of the fields to remove.

stout

A struct variable having the same dimensions as stin from which some fields have be removed.

Description

The rmfield function removes fields from a struct but without modifying its dimensions. If fields is an empty matrix or an empty cell, then stin and stout are the same.

Examples

st = struct("a", 1, "b", 2, "c", 3, "d", 4)
s2 = rmfield(st, []) // No fields will be removed
s1 = rmfield(st, "a")
s3 = rmfield(st, {"b", "c"})
s4 = rmfield(st, {"b", "c"; "d", "a"}) // All fields will be removed

See also

  • struct — Builds a structure or an array of structures
  • fieldnames — récupère le nom des champs d'une tlist, d'une mlist ou d'une struct

History

VersionDescription
2025.1.0 Function rmfield introduced.
Report an issue
<< rlist Listes Structures Cells setfield >>

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:
Thu May 22 12:54:26 CEST 2025