Warning in result lines: mx_el_eq: automatic translation is applied
I have a matrix s
, for example:
s =
1 2 3
4 5 2
4 4 2
I want to find rows where 4 is in the first column and 5 is in the second, so I create this:
sum((s(:,1:2) == [4 5]),2) == 2
Which works great and returns:
ans = 0 1 0
Everything was great, but this part of the code: s(:,1:2) == [4 5]),2)
generates a warning:
warning: mx_el_eq: automatic broadcast operation is applied
What is the correct way to compare more than one column? I want to generate code without warnings.
source to share
The reason you get the warning is because auto-broadcast is a new feature that can catch users off guard. This warning was temporary and has since been removed (Octave 4.0.0 was the first version to remove this warning).
This does not mean that you are doing something wrong, quite the opposite. If it works for you, you've found a pretty powerful new feature. If you are comfortable using this feature, you can turn off the warning:
warning ("off", "Octave:broadcast")
source to share