any!

any!(r, A)

Test whether any values in A along the singleton dimensions of r are true, and write results to r.

Examples

julia> r = falses(2, 3);
julia> A = [false true false; false false true];
julia> any!(r, A)
2×3 BitMatrix:
 0  1  0
 0  1  1

This example demonstrates the usage of any! function in Julia. It tests whether any values in matrix A along the singleton dimensions of matrix r are true, and writes the results to matrix r.

Common mistake example:

julia> r = falses(2, 2);
julia> A = [false false; false false; false false];
julia> any!(r, A)
ERROR: DimensionMismatch("input array has size (3,2) but destination has size (2,2)")

In this example, the dimensions of the destination matrix r do not match the dimensions of the input matrix A. It is important to ensure that the dimensions are compatible to avoid such errors when using any! function.

See Also

all, all!, angle, any, any!, falses, ifelse, is, isinf, isinteger, isnan, isperm, ispow2, isreal, trues,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: