Borrar filtros
Borrar filtros

How to get the matrix when I need a logic matrix

3 visualizaciones (últimos 30 días)
PRED LIU
PRED LIU el 21 de Mayo de 2020
Comentada: Steven Lord el 21 de Mayo de 2020
How to get a matrix QQQQ when I need a logic matrix AAAA
AAAA=[
true true true true false true true
true true true true false true true
true true true true false true true
true true true true false true true
]
y=[
0.0246 0.4415 0.0274 0.0269 0.0264 0.0255 0.0557
0.4535 0.0260 0.4495 0.4455 0.0563 0.0566 0.0569
0.0251 0.0542 0.0545 0.0548 0.0551 0.0554 0.0563
1.0000 0.1615 0.0061 0.0156 0.0692 0.1323 0.0001
]
QQQQ
[
0.0246 0.4415 0.0274 0.0269 0 0.0255 0.0557
0.4535 0.0260 0.4495 0.4455 0 0.0566 0.0569
0.0251 0.0542 0.0545 0.0548 0 0.0554 0.0563
1.0000 0.1615 0.0061 0.0156 0 0.1323 0.0001
]

Respuesta aceptada

David Hill
David Hill el 21 de Mayo de 2020
QQQQ=AAAA.*y;
  1 comentario
Steven Lord
Steven Lord el 21 de Mayo de 2020
That works as long as all elements in y are finite.
Inf*false
I'd use logical indexing.
QQQQ = zeros(size(y));
QQQQ(AAAA) = y(AAAA);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by