Le 05/12/2019 à 14:25, Federico Miyara a écrit :

Dear all,

When using makecell such as in

--> u = makecell([2 2], cos, 'hello', 1+%s^2, [1 2; 3 4])
 u  =

  [  1 fptr      ]  [1x1 string  ]
  [1x1 polynomial]  [2x2 constant]

we get a cell array where the unidimensional ordering of the cells goes first along columns and then ows. However, when extracting components unidimensionally, it behaves the other way around:

--> u(1:4)
 ans  =

  [  1 fptr      ]
  [1x1 polynomial]
  [1x1 string    ]
  [2x2 constant  ]

The same happens wen applying matrix:

--> matrix(u,4,1)
 ans  =

  [  1 fptr      ]
  [1x1 polynomial]
  [1x1 string    ]
  [2x2 constant  ]

--> matrix(u,1,4)
 ans  =

  [1 fptr]  [1x1 polynomial]  [1x1 string]  [2x2 constant]

Isn't this inconsistent?
Shouldn't makecell create the cell array going along rows and then columns?


You are right, Federico.
We could have expected to list cells elements in linearized indices order, as for all other native Scilab arrays.

This irregularity/exception is completely useless and misleading:

--> c = { "abcd" %T ; %pi %z}
 c  =
  [1x1 string  ]  [1x1 boolean   ]
  [1x1 constant]  [1x1 polynomial]

--> makecell([2 2], c{:}(:))
 ans  =
  [1x1 string ]  [1x1 constant  ]
  [1x1 boolean]  [1x1 polynomial]

The fact that it is documented does not attenuate it.

Please do not hesitate to report a wish about removing this exception.
It would not be complicated to remove it, and tracking and updating it in existing codes would be easy, through the /makecell/ keyword.

Regards
Samuel

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to