Borrar filtros
Borrar filtros

Combining two logical vectors

99 visualizaciones (últimos 30 días)
Stephen
Stephen el 5 de Abr. de 2016
Editada: Azzi Abdelmalek el 5 de Abr. de 2016
Dear All, I have 2 logical vectors:
vec1 = false(5,1);
vec1(1,1)=1; %vec1 = [1 0 0 0 0]';
vec2 = false(5,1);
vec1(5,1)=1; %vec2 = [0 0 0 0 1]';
I would like to obtain vec3 such that it contains 1 in a specific row if either vec1 or vec2 contain 1. That is,
%vec3 = [1 0 0 0 1]';
I have been unsuccessfully trying to use union or setxor Thank you for your help,
Best,S

Respuesta aceptada

Kuifeng
Kuifeng el 5 de Abr. de 2016
vec3 = or(vec1,vec2);

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by