Sciab 2024.1.0 new command line display of objects

Hello Scilab users,

As you may have noticed in the change log, Scilab now displays the type and size of expression results, which is very helpful for all class of users (from beginners to advanced) and avoids confusions. See the following examples:

Array types

--> x=rand(3,3)

 x = [3x3 double]

   0.5595937   0.2677766   0.7395657
   0.124934    0.5465335   0.0037173
   0.7279222   0.9885408   0.5900573

--> y=uint8(x*256)

 y = [3x3 uint8]

  143   68  189
   31  139    0
  186  253  151

--> y>0

 ans = [3x3 boolean]

  T T T
  T T F
  T T T

--> num2cell(x)

 ans = {3x3 cell}

  0.5595937    0.2677766    0.7395657
  0.124934     0.5465335    0.0037173
  0.7279222    0.9885408    0.5900573

--> string(x)

 ans = [3x3 string]

  "0.5595937"  "0.2677766"  "0.7395657"
  "0.124934"   "0.5465335"  "0.0037173"
  "0.7279222"  "0.9885408"  "0.5900573"

The type and size information is displayed just on the right of the equal sign, hence it does not add any extra line in the output.

Containers and user types

List and container types now also have an improved display. For example tlist and mlist types have the following default display (the same as structs) when no display overload has been defined:

--> t = tlist(["user" "a" "b"],1,rand(10,10))

 t = (user tlist) with fields:

  a = 1
  b: [10x10 double]

and basic lists now display their length:

--> list(cos,1,2,rand(10,10))

 ans = (4-elements list)

  (1): function
  (2) = 1
  (3) = 2
  (4): [10x10 double]

Generally speaking, we started updating the display of other specialized types by using the same subsystem as classical containers (lists, structs, tlists, mlists, some cases are still missing but we are working on it):

Handles

--> gcf

 ans = [Figure] with properties:

  children: [Axes]
  figure_position = [879,240]
  figure_size = [610,562]
  axes_size = [610,460]
  auto_resize = "on"
  viewport = [0,0]
  ...

--> gce

 ans = [Compound] with properties:

  parent: [Axes]
  children: [41x1 handle]
  visible = "on"
  user_data = []
  tag = ""

XML

--> xmlRead("SCI/modules/xml/tests/unit_tests/library.xml").root

 ans = (XMLElem) with fields:

  name = "library"
  namespace = []
  type = "XML_ELEMENT_NODE"
  parent = []
  attributes: (empty XMLAttr)
  children: (1x2 XMLList)
  content: [1x1 string]
  line = 4

Xcos

--> importXcosDiagram("SCI/modules/xcos/tests/unit_tests/pendulum_anim45.zcos");

--> scs_m

 scs_m = (diagram) with fields:

  props: (params tlist) with fields:
      wpar = [600,450,0,0,600,450]
      title: [2x1 string]
      tol = [0.000001,0.000001,1.000D-10,100001,0.1,1,0]
      tf = 30
      context: [9x1 string]
      void1 = []
      options: (scsopt tlist) with fields:
          3D: (2-elements list)
          Background = [8,1]
          Link = [1,5]
          ID: (2-elements list)
          Cmap = [0.8,0.8,0.8]
      void2 = []
      void3 = []
      doc: (empty list)
  objs: (36-elements list)
      (1): (CONST_f Block)
      (2): (CMSCOPE Block)
      (3): (CLOCK_f Block)
      (4): (SUPER_f Block)
      (5): (CLSS_f Block)
      (6): (MUX Block)
      (7): (SUMMATION Block)
      (8): (PENDULUM_ANIM Block)
      (9): (CLKSPLIT_f Block)
      (10): (SPLIT_f Block)
      (11): (SPLIT_f Block)
      (12): (SPLIT_f Block)
      (13): (SPLIT_f Block)
      (14): (SPLIT_f Block)
  version = "scicos4.4"
  contrib: (empty list)

Don’t hesitate to submit other suggestions, missing cases, …

S.

3 Likes