Ask Your Question
0

introducing vectors with boolean operations

asked 2019-08-10 23:03:47 +0200

ernesto gravatar image

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 flag offensive close merge delete

Comments

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

Please edit your question to add additional information. Thanks in advance.

Opaque gravatar imageOpaque ( 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

m.a.riosv gravatar imagem.a.riosv ( 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.

Mike Kaganski gravatar imageMike Kaganski ( 2019-08-11 12:14:15 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-08-11 15:48:45 +0200

Lupp gravatar image

updated 2019-08-11 15:53:27 +0200

-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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-08-10 23:03:47 +0200

Seen: 34 times

Last updated: Aug 11