help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Vectorization with max / min in matrix


From: Pedro
Subject: Vectorization with max / min in matrix
Date: Sun, 3 Mar 2013 16:19:22 +0100

Hi,

I have two vectors/matrix, and I want to get his minimum values for
every position without doing for/while/etc statement

But there is a problem:

a = randi([1 31],1,10);
b = randi([1 31],1,10);
a( a < b ) = b;
error: A(I) = X: X must have the same size as I

I don't know why doesn't work, have the same size (perhaps it is not a
bug because is the same error in Matlab).
What is going wrong?

The original idea was to apply this to a matrix, but does not work
with a vector...

a = randi([1 31],8,8);
b = randi([1 31],8,8);
a( a < b ) = b;

Greetings,
Pedro


reply via email to

[Prev in Thread] Current Thread [Next in Thread]