Correction SS-2309
2 votes

stack/augment first argument

Created by Davide on 4/1/2016 2:09 PM Last Updated by Davide on 12/2/2016 7:28 PM
%
 (hrs)
Logged: 0   (hrs)

 Description

Please investigate if may be consistent to improve stack/augment to accept as first argument a number or a string (meaning the desired output will be a column or a row vector); actually you must wrap them in a 1x1 matrix.

    Davide (Friday, December 2, 2016 7:27 PM) #

Implemented in SMath Studio 0.98.6179.

    Mike Kaganski (Wednesday, April 6, 2016 10:29 PM) #

Currently (as of 0.98.5935.13216), it is only possible to use number as first argument to stack/augment, if all arguments are numbers, too (or if the number is the only argument). It's impossible if other arguments are matrices/strings.

It's impossible to use string as first argument to these functions in any way.

There are two work-arounds currently possible.

  1. If the resulting matrix dimensions are known, then one can use matrix(0;n) as first argument to stack / matrix(n;0) for augment (where n is resulting column/row number) so that actual arguments start from second argument: stack(matrix(0;1);a1;a2;...) - aN may be any type (but matrices must have n columns).
  2. If there may NOT be strings, then more general approach may be used: stack(matrix(0;length(stack(a1)));a1;a2;...) - here, if a1 is a number, resulting matrix will have one column; if a1 as a martix, then resulting matrix will have the same number of columns as a1.

Also, it's currently impossible to get stack/augment of a sys() with more than one line (and no text in system, too).