# introducing vectors with boolean operations

suppose we have data in cells as
B1=100
C1=200
D1=300

A1=200

and we want to introduce the following matrix operation
B2=mmult( transpose( {1;1} ) ; { -(B1'<'$A$5) ; (B1'>='$A$5) } )

finally we want to copy the same vector in cells B2 and B3

is it possible? how should we do that?
thanks

edit retag close merge delete

Please give an example of what you want to achieve - your formula above is not a valid formula.

( 2019-08-11 00:30:45 +0200 )edit
1

As I know you can't introduce formulas in an inner array. Using_Inline_Array_Constants_in_Formulas

( 2019-08-11 02:05:00 +0200 )edit

Also the A5 mentioned in the formula isn't mentioned in the data definition... and C1 and D1 from data definition aren't mentioned in the task.

( 2019-08-11 12:14:15 +0200 )edit

Sort by » oldest newest most voted

-1- Inline arrays are restricted to constant elements in Calc. That's ODF.
-2- The meaning of A5 is not explained (as already mention in comments). You probably mean $A$1.
-3- How to use C1 and D1 is not explained.
-4- A 2x1 column-vector multiplied with a 1X2 row-vector would result in a 2x2 matrix.
-5- Omitting the transposition you would get (1x2) * (1x2) which would result in a scalar product or -to virtually the same effect- to a 1x1 matrix: a single element.

Finally: If you meant something like =MMULT(TRANSPOSE(MAKEARRAY(1;1));MAKEARRAY(-(E1<$A$1);(E1>=$A$1))) you would need to create a user function for makeArray, which is simple for highly specialised cases, but not quite as simple for more general cases. The "more general" case would specifically need to provide treatment for application with expressions under array-evaluation.

For the "very simple" case restricted to be applied to a pair taken as an 1x2 vector, the following code should do:

Function makeArray(p1, p2)
makeArray = Array(p1, p2)
End Function


For the output to a cell range or to a parameter position Calc would automatically transform the result to the needed 2D (precisely 1D 1X1 of 1D 1x2) representation.

more