How to apply OR operation to a matrix?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
pietro
am 12 Jul. 2014
Beantwortet: Roger Stafford
am 12 Jul. 2014
Hi folk,
I need to apply the OR operation to the column of a matrix. Here an example:
a=[0 0 1; 0 1 1];
orMat(a)=
[0 0 1]
thanks
0 Kommentare
Akzeptierte Antwort
Roger Stafford
am 12 Jul. 2014
Your example is not the 'OR', it is the 'AND', of the columns. The 'OR' of the columns is done this way:
b = any(a,1);
The 'AND' would be done this way:
b = all(a,1);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Construct and Work with Object Arrays finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!