I am solving some matrix problems in Julia and i need to put numbers that can be divided by 2 (or any other number) from matrix in separate vector. Generally, when I need to separate numbers from matrix that can be divided with 2 or 3 or 4...etc i can't index them properly. Basically, I need Julia equivalent for Matlab command:
vector=matrix(rem(matrix,2)==0)
.
I tried few things mentioned below:
vector=matrix[matrix.%2==0];
vector=(matrix.%2==0);
I expect output to be vector of numbers that can be divided with certain number but in first case I get errors and in second I only get "true" or "false".
This is my first post, so sorry if I made any mistakes or broke any rules. Thanks in advance!