On 2/14/2015 10:19 PM, Kayuri Shah wrote:
> Within a matrix, I want to be able to retrieve
>only odd numbers within the matrix, and place that into its own matrix.
>
> What I have right now is:
>
> x = randn(1,100);
> odd = mod(x, (x/2))
>
> I'm not able to get the new matrix, odd,
>to print with the odd values from x, even
>
try with randi.
may be something like
x = randi(100,15,1);
odd = x(logical(mod(x,2)))
even = x(logical(~mod(x,2)))
> Within a matrix, I want to be able to retrieve
>only odd numbers within the matrix, and place that into its own matrix.
>
> What I have right now is:
>
> x = randn(1,100);
> odd = mod(x, (x/2))
>
> I'm not able to get the new matrix, odd,
>to print with the odd values from x, even
>
try with randi.
may be something like
x = randi(100,15,1);
odd = x(logical(mod(x,2)))
even = x(logical(~mod(x,2)))